[Twisted-Python] [newb] another process question

Tim Allen screwtape at froup.com
Fri Nov 5 21:19:05 EDT 2010

On Fri, Nov 05, 2010 at 07:28:24PM -0400, Neal Becker wrote:
> 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.

The deal is, there are multiple kinds of 'went wrong' in the Unix
process model. One kind (described the documentation you quote above) is
a non-zero exit code; you can test this by running "/bin/false" rather
than "sleep 15" as your test command. Another kind is 'killed by
a signal', in which case the value "returned" by the process encodes the
number of the signal that killed it, rather than a process-defined error

Looking at the source of the ProcessTerminated class mentioned:


...it looks like killing a process with a signal puts 'None' in the
.exitCode property, and the signal number in the .signal property. The
instance also has a useful str() representation if you just want to log
a sensible error message.

More information about the Twisted-Python mailing list