开发者

start without inheritance of parents file descriptors

开发者 https://www.devze.com 2022-12-19 20:10 出处:网络
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 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).

I don't want to use:

  • createProcess (from w开发者_高级运维inAPI, where this can be setup to not inherit fds)
  • use python in my start string (or any similar interpreters)

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

with commandline like:

psexec -d -s myprogram > logfile.log 2>&1

everything is solved.


powershell -command "Start-Process myprogram.exe"
0

精彩评论

暂无评论...
验证码 换一张
取 消