I would like:
- Launch a new process (myexe.exe arg1) from my process (myexe.exe arg0)
- Retrieve the PID of this new process (os windows)
- when I kill my first entity (myexe.exe arg0) with the TaskManager Windows Command "End process tree", I need that the new one (myexe.exe arg1) will not be killed...
I've played with subprocess.Popen, os.exec, os.spawn, os.system... without success.
Another way to explain the problem: How to protect myexe.exe (arg1) if someone kills the "process tree" of the myexe.exe (arg0)?
EDIT: same question (without answer) HERE
EDIT: the following command do not guarantee the Independence of the subprocess
subprocess.Popen(["myexe.exe",arg[1]],creationflags = DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP,close_fds = True)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…