how to kill a subprocess
python at mrabarnett.plus.com
Fri Sep 10 01:18:24 CEST 2010
On 09/09/2010 23:52, cerr wrote:
> On Sep 9, 3:29 pm, Alain Ketterlin<al... at dpt-info.u-strasbg.fr>
>> cerr<ron.egg... at gmail.com> writes:
>>> I'm calling a python script from a php script which again calls a perl
>>> script with subprocess.popen().
>>> This seems to work fine so far only that once the python script
>>> completed it is becoming a zombie because the perl script in the
>>> background is still running... so before i exit the python script, i
>>> would need to kill my perl subprocess.
>>> How can i do so?
>> x.terminate() (and then x.wait()) where x is the value returned by
> Well, this is what I have:
> writelog("starting GPS simulator")
> writelog(commandlist+" "+commandlist+" "+commandlist)
> writelog("GPS simulator started")
> but this is not working for me... :( any clues?
>> P/S: I'm not sure why the python process survives, and I think your use
>> of "zombie" is not correct (afaik a zombie is an exited process whose
>> parent hasn't called wait() yet)
> This is what I have:
> localhost cgi-bin # ps ax | grep py
> 11853 ? Z 0:00 [python2.6]<defunct>
> 12029 pts/1 S+ 0:00 grep --colour=auto py
> The 'Z' you see there stands for Zombie
process.kill() # New in Python 2.6
More information about the Python-list