[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

Portably killing/signalling another process not supported?

John Nagle

1/26/2008 5:28:00 PM

There doesn't seem to be any way to portably kill another process
in Python. "os.kill" is Mac/Unix only. The "signal" module only lets
you send signals to the current process. And the "subprocess" module
doesn't have a "kill" function.

Subprocess objects really should have a portable "interrupt" or
"kill" function. They already have "poll" and "wait", which have
to be implemented differently for different systems; that's the
logical place for "kill".

Yes, there are nonportable workarounds
(http://aspn.activestate.com/ASPN/Cookbook/Python/Rec...)
but no portable solution.

John Nagle
2 Answers

Christian Heimes

1/26/2008 5:40:00 PM

0

John Nagle wrote:
> There doesn't seem to be any way to portably kill another process
> in Python. "os.kill" is Mac/Unix only. The "signal" module only lets
> you send signals to the current process. And the "subprocess" module
> doesn't have a "kill" function.
>
> Subprocess objects really should have a portable "interrupt" or
> "kill" function. They already have "poll" and "wait", which have
> to be implemented differently for different systems; that's the
> logical place for "kill".
>
> Yes, there are nonportable workarounds
> (http://aspn.activestate.com/ASPN/Cookbook/Python/Rec...)
> but no portable solution.

We are looking for somebody to implement a portable and cross platform
implementation of kill() and send_signal() for the subprocess module.
Are you interested in working on a patch for Python 2.6 and 3.0?

John Nagle

1/26/2008 8:26:00 PM

0

Christian Heimes wrote:
> John Nagle wrote:
>> There doesn't seem to be any way to portably kill another process
>> in Python. "os.kill" is Mac/Unix only. The "signal" module only lets
>> you send signals to the current process. And the "subprocess" module
>> doesn't have a "kill" function.
>>
>> Subprocess objects really should have a portable "interrupt" or
>> "kill" function. They already have "poll" and "wait", which have
>> to be implemented differently for different systems; that's the
>> logical place for "kill".
>>
>> Yes, there are nonportable workarounds
>> (http://aspn.activestate.com/ASPN/Cookbook/Python/Rec...)
>> but no portable solution.
>
> We are looking for somebody to implement a portable and cross platform
> implementation of kill() and send_signal() for the subprocess module.
> Are you interested in working on a patch for Python 2.6 and 3.0?
>
Since I use 2.4 and 2.5, I'm interested in something that
goes back to at least 2.4.

The ActiveState solution above needs C modules that aren't part of
the regular CPython distribution, unfortunately.

John Nagle