def maybeCallProcessEnded(self):
# we don't call ProcessProtocol.processEnded until:
# the child has terminated, AND
# all writers have indicated an error status, AND
# all readers have indicated EOF
# This insures that we've gathered all output from the process.
if self.pipes:
#print "maybe, but pipes still", self.pipes.keys()
return
if not self.lostProcess:
#print "maybe, but haven't .lostProcess yet"
self.reapProcess()
return
try:
exitCode = sig = None
if self.status != -1:
if os.WIFEXITED(self.status):
exitCode = os.WEXITSTATUS(self.status)
else:
sig = os.WTERMSIG(self.status)
else:
pass # don't think this can happen
if exitCode or sig:
e = error.ProcessTerminated(exitCode, sig, self.status)
else:
e = error.ProcessDone(self.status)
if self.proto is not None:
self.proto.processEnded(failure.Failure(e))
self.proto = None
except:
log.err()
评论列表
文章目录