I am trying to start new command lines from script, for example:
p = subprocess.Popen('start cmd /c "C:\\Program Files\\Redis\\redis-server.exe"', shell=True)
And then get it's children with:
p2 = psutil.Process(pid)
children = p2.children()
However before I am able to do that the process with shell that gets invoked to create my cmd with server started is terminated automatically (the p2 process). Therefore I can't access it's children.
Is there any other way I can access the spawned children or can I stop the shell process from terminating itself?
If I try to start new cmd with shell=False I get "WindowsError: [Error 2] The system cannot find the file specified"