1

Kill subprocess in python using pid

view story
linux-howto

http://stackoverflow.com – I am using subprocess in python to start a program.When it starts it saves the pid of the process created in a database.After some time and if a trigger happens it needs to stop this process and start a new one. The problem is that when I use subprocess.Popen().pid it returns the pid of a zombie process (defunct) and not the real process I need to stop.I cannot use the terminate command since the start process command and the kill command happens in different scripts.So I need a way to get the real pid of the process I am starting and not the pid of the zombie process. (HowTos)