self.tub.setServiceParent(self.sparent)
self.discard_shares = True
self.mode = mode
+ self.failed = False
def run(self):
log.startLogging(open(os.path.join(self.basedir, "log"), "w"),
d.addCallback(lambda res: self.do_test())
d.addBoth(self.tearDown)
def _err(err):
+ self.failed = err
log.err(err)
print err
d.addErrback(_err)
- d.addBoth(lambda res: reactor.stop())
+ def _done(res):
+ reactor.stop()
+ return res
+ d.addBoth(_done)
reactor.run()
+ if self.failed:
+ self.failed.raiseException()
def setUp(self):
#print "STARTING"
# control.furl file to appear.
furl_file = os.path.join(clientdir, "control.furl")
def _check():
- if pp.ended:
+ if pp.ended and pp.ended.value.status != 0:
+ # the twistd process ends normally (with rc=0) if the child
+ # is successfully launched. It ends abnormally (with rc!=0)
+ # if the child cannot be launched.
raise RuntimeError("process ended while waiting for startup")
return os.path.exists(furl_file)
d = self.poll(_check, 0.1)
def errReceived(self, data):
print "ERR:", data
def processEnded(self, reason):
- print "PROCESSENDED", reason
- self.ended = True
+ self.ended = reason
self.d.callback(None)