在不继承父文件描述符的情况下启动 [英] start without inheritance of parents file descriptors
问题描述
我需要用start"命令在winXP上启动一些进程.听起来很简单.
I need to start some process on winXP with "start" command. Sounds simple.
但是有没有办法让启动的进程不会从父进程继承任何端口?
But is there a way that the started process would not inherit any ports from parent?
我开始在我的程序中使用:
I start children in my program using:
system "start x -params"
现在当父进程被杀死时,我无法再次启动它,因为我从错误中了解到某个进程已经占用了端口(被杀死的父进程正在使用).
Now when parent is being killed, I can't start it again because I'm learned by errors that some process is already occupying port (which killed parent was using).
我不想使用:
- createProcess(来自 winAPI,可以设置为不继承 fds)
- 在我的起始字符串(或任何类似的解释器)中使用 python
有没有办法以我希望他们开始的方式开始我的子进程?
Is there a way to start my child process in a way I want them to start?
有什么开始"的选择吗?
Is there any "start" alternative?
推荐答案
所以在挖掘了一段时间后,我发现:
So after diggin a while, i've found:
psexec
使用命令行如:
psexec -d -s myprogram > logfile.log 2>&1
psexec -d -s myprogram > logfile.log 2>&1
一切都解决了.
这篇关于在不继承父文件描述符的情况下启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!