Reputation: 45
I able to launch a tornado subprocess
sp = tornado.process.subprocess(..)
but want to have the ability to kill the same on some event.
The only way I could manage to do this, by perusing the code, is to use the terminate() method of the 'proc' attribute of the tornado subprocess object since the tornado subprocess constructor initializes the 'proc' attribute to the Subprocess Popen. So :
sp.proc.terminate()
seems to work. However I am not sure that's the best way
Also how to get the returncode? Trying to use
sp.proc.returncode
seems to return None
Upvotes: 0
Views: 272
Reputation: 22154
Yes, sp.proc.terminate()
is currently the best way; we don't expose either the terminate method or the process ID directly.
To get the return code, you must use sp.wait_for_exit()
or sp.set_exit_callback()
.
Upvotes: 1