def testAbnormalTermination(self):
if os.path.exists('/bin/false'): cmd = '/bin/false'
elif os.path.exists('/usr/bin/false'): cmd = '/usr/bin/false'
else: raise RuntimeError("false not found in /bin or /usr/bin")
d = defer.Deferred()
p = TrivialProcessProtocol(d)
reactor.spawnProcess(p, cmd, ['false'], env=None,
usePTY=self.usePTY)
def check(ignored):
p.reason.trap(error.ProcessTerminated)
self.assertEquals(p.reason.value.exitCode, 1)
self.assertEquals(p.reason.value.signal, None)
d.addCallback(check)
return d
评论列表
文章目录