how to kill a subprocess

Christian Heimes lists at cheimes.de
Fri Sep 10 14:45:32 EDT 2010


Am 10.09.2010 19:51, schrieb cerr:
> Thanks for your suggestion, changed my code now to:
> 
>   process=subprocess.Popen(commandlist)
>   ...
>   ...
>   process.kill()
>   os.waitpid(process.pid, 0)
> but it's not killing the process running. it still runs in the
> background and i don't see any errors, we're running python 2.6.4
> any more clues?

It's not an issue with your Python process but with its parent process.
The parent process has to call the OS's waitpid() function with the PID
of the Python process in order to reap it. Please show us how you are
starting and controlling the Python process in your PHP code.

Christian




More information about the Python-list mailing list