[Twisted-Python] spawnProcess and kill the child process.

holsety huang hoooooosety at gmail.com
Tue Nov 27 07:04:13 MST 2012


hi, all

I start a process using spawnProcess and want to kill when my certain
Factory stops.

something I wrote like these


----------

p = SomeProtocol(ProcessProtocol)

reactor.spawnProcess(p, 'twistd', ['twistd', '-y', 'anotherMain.py'], {})

----------

class Factory(ServerFactory):
...

def StopFactory(self):
 # which is the p above
 p.transport.signalProcess("KILL")

I thought the subprocess will be killed which is not.

I tried using p.transport.signalProcess("KILL") some other place, and it
works.

What's wrong with my code? Thanks!

P.S, which is the best way to shut down a twistd, I send the TERM to it
now. It just work fine.


Regards, Huang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20121127/79d196da/attachment.html>


More information about the Twisted-Python mailing list