[Twisted-Python] Killing a process
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.
On Thu, 17 Aug 2006 15:50:22 +0200, Igor Kravtchenko
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
On Aug 17, 2006, at 10:09 AM, Jean-Paul Calderone wrote:
Process termination with Twisted on Windows is unreliable, though, so whether or not it will work in your specific case is uncertain.
I don't think that is true. TerminateProcess works fine to kill a single process. What isn't supported is killing a processes group, or asking a process politely to quit. On Aug 17, 2006, at 11:40 AM, Manlio Perillo wrote:
Try with http://svn.berlios.de/svnroot/repos/pykill32/trunk/.
It uses an hack (create a thread on the remote process) but it seems to work fine, at least with Python process and Twisted.
That shouldn't be necessary if you just want to kill dead the process. James
On Thu, 17 Aug 2006 12:02:43 -0400, James Y Knight
On Aug 17, 2006, at 10:09 AM, Jean-Paul Calderone wrote:
Process termination with Twisted on Windows is unreliable, though, so whether or not it will work in your specific case is uncertain.
I don't think that is true. TerminateProcess works fine to kill a single process. What isn't supported is killing a processes group, or asking a process politely to quit.
Observations disagree. Jean-Paul
Igor Kravtchenko ha scritto:
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,
Try with http://svn.berlios.de/svnroot/repos/pykill32/trunk/. It uses an hack (create a thread on the remote process) but it seems to work fine, at least with Python process and Twisted. Regards Manlio Perillo
participants (4)
-
Igor Kravtchenko
-
James Y Knight
-
Jean-Paul Calderone
-
Manlio Perillo