I'm running a parallel process in python:
process = subprocess.Popen(['python',path, title, uid])
The program takes + - 1 minute to finish and run normally. The process generates a PID that I can capture: process.pid
. In one example it generated PID 29058
. I have another program that will handle these PIDs and check which one ended up through the function:
def check_pid(pid):
try:
os.kill(pid, 0)
except OSError:
return False
else:
return True
That also works normally.
But even though my program I ran on Popen
ended, and I'm pretty sure that happens. The process in Ubuntu still continues running the process, without consuming memory and nothing:
My main program which I call the first command above is a Bottle server that will not end unless I want to. When I kill the Bottle server process this PID 29058
process also dies. What I want to know is if there are any parameters that I pass in Popen that causes the process to die automatically when it finishes and not to stay that way?