Can Python kill a child process that keeps on running?

I. Myself No.Spam at Spam.none
Mon May 1 21:48:28 EDT 2006


Serge Orlov wrote:
> I. Myself wrote:
>   
>> Suppose we spawn a child process with Popen.  I'm thinking of an
>> executable file, like a compiled C program.
>> Suppose it is supposed to run for one minute, but it just keeps going
>> and going.  Does Python have any way to kill it?
>>
>> This is not hypothetical; I'm doing it now, and it's working pretty
>> well, but I would like to be able to handle this run-on condition.  I'm
>> using Windows 2000, but I want my program to be portable to linux.
>>     
>
> On linux it's pretty easy to do, just setup alarm signal. On windows
> it's not so trivial to the point you cannot do it using python.org
> distribution, you will need to poke in low level C API using win32
> extensions or ctypes. AFAIK twisted package <http://twistedmatrix.com>
> has some code to help you. Also take a look at buildbot sources
> <http://buildbot.sf.net> that uses twisted. Buildbot has the same
> problem as you have, it needs to kill run away or non-responding
> processes.
>   
That is bad news.   Thanks anyway; bad news is better than no news.

Mitchell Timin

-- 
I'm proud of http://ANNEvolve.sourceforge.net.  If you want to write software,
or articles, or do testing or research for ANNEvolve, let me know.

Humans may know that my email address is: (but remove the 3 digit number)
zenguy at shaw666 dot ca





More information about the Python-list mailing list