我想:
我玩过subprocess.Popen,os.exec,os.spawn,os.system。。。没有成功。
另一种解释问题的方法是:如果有人杀死myexe.exe(arg0)的“进程树”,如何保护myexe.exe(arg1)?
编辑:相同的问题(没有答案)HERE
编辑:以下命令不能保证子进程的独立性
subprocess.Popen(["myexe.exe",arg[1]],creationflags = DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP,close_fds = True)
要启动在Windows上父进程退出后可以继续运行的子进程,请执行以下操作:
Windows进程创建标志是here
A more portable version is here。
所以,如果我理解正确,代码应该如下:
至少我试过这个,为我工作过。
几年前我在windows上也做过类似的事情,我的问题是想终止child进程。
我想您可以使用
pid = Popen(["/bin/mycmd", "myarg"]).pid
运行子进程,所以我不确定真正的问题是什么,所以我猜是在您终止主进程时。这和旗帜有关。
我不能证明,因为我没有开窗户。
相关问题 更多 >
编程相关推荐