[Twisted-Python] [newb] another process question
ndbecker2 at gmail.com
Fri Nov 5 19:28:24 EDT 2010
Using this code:
def processEnded(self, reason):
print "processEnded, task %s, status %s" % (self.task,
Here is what I get from a normally terminated process
processEnded, task ['sleep', '4']31662, status 0
But now I kill the subprocess, with SIGTERM, and I get:
processEnded, task ['sleep', '15']31663, status None
This seems to disagree with the twisted process doc.
Instead of an exitCode, I seem to have gotten 'None'
.processEnded(status): This is called when the child process has been
reaped, and receives information about the process' exit status. The status
is passed in the form of a Failure instance, created with a .value that
either holds a ProcessDone object if the process terminated normally (it
died of natural causes instead of receiving a signal, and if the exit code
was 0), or a ProcessTerminated object (with an .exitCode attribute) if
something went wrong. This scheme may seem a bit weird, but I trust that it
proves useful when dealing with exceptions that occur in asynchronous code.
More information about the Twisted-Python