[Twisted-Python] Sane way to get the exit code from reactor.spawnProcess(SomeProtocol, ...)

Itamar Shtull-Trauring itamar at itamarst.org
Tue Jun 24 19:39:48 EDT 2008

On Tue, 2008-06-24 at 16:43 -0600, Nathan wrote:
> Is there a more sane way to get the exit code from a ProcessProtocol
> than by parsing it out of reason.value in
> ProcessProtocol.processEnded()?  I can't seem to find the error code
> by itself anywhere. (see example code at bottom)
> If I replace "print reason.value" with "print dir(reason)" below, then
> I get the following output for both successful and unsuccessful
> spawns:

reason.value will be instance of ProcessExited or something (it's in
twisted.internet.error), which should have exitCode attribute or
something. Check the API reference for twisted.internet.error.

More information about the Twisted-Python mailing list