Your atom command is probably a .cmd file that runs the executable, which explains the need for shell=True
You will not go on to re-encode the .bat file extension in python, BUT you also don't need an executable PID.
If the executable ends, the batch file ends, so forget about monitoring prog.pid , just view the prog with poll (in the same python script, of course).
The poll method allows you to check whether the process has completed (if there is one, it returns an exit code if it does not return None ) and this does not block, so you can do this at any time:
if prog.poll() is not None:
We remind you about blocking the wait for this:
return_code = prog.wait()
But in your case, the atom.cmd command seems to start the process in the background, which makes monitoring impossible without a PID.
The workaround in this case is to make a copy of atom.cmd , remove the start prefix to run the executable in the foreground, and instead start the copy.
(or since cmd calls another atom.cmd file when commenting, find the file app-1.13.0\resources\cli\atom.cmd from atom.cmd source directory and remove the start prefix there)
source share