[Twisted-Python] Killing a process

Jean-Paul Calderone exarkun at divmod.com
Thu Aug 17 10:09:17 EDT 2006


On Thu, 17 Aug 2006 15:50:22 +0200, Igor Kravtchenko <igor at mekensleep.com> wrote:
>Hi,
>
>I wondered last time what is the best way under Win32 to kill a process 
>launched with:
>reactor.spawnProcess()
>
>os.kill() as documented here:
>http://docs.python.org/lib/os-process.html#l2h-1676
>only works under Macintosh and Unix.
>
>Furthermore, spawnProcess() doesn't return any handle, process ID or 
>anything
>to deal with.
>
>Any help or idea would be really appreciated,
>
>Igor.
>

spawnProcess returns an IProcessTransport, which has a signalProcess
method, which you can pass 'KILL' to end the process.

Process termination with Twisted on Windows is unreliable, though, so
whether or not it will work in your specific case is uncertain.

Jean-Paul




More information about the Twisted-Python mailing list