run next command when this one fails

This commit is contained in:
lilydjwg 2014-03-27 14:26:07 +08:00
parent 386b8e3a6d
commit 7fea77f5ae

View file

@ -92,12 +92,15 @@ class RepoMan:
return return
logger.info('Running cmd: %r', cmd) logger.info('Running cmd: %r', cmd)
# have to specify io_loop or we'll get error tracebacks # have to specify io_loop or we'll get error tracebacks in some versions
# of Tornado
try: try:
p = tornado.process.Subprocess(cmd, io_loop=self._ioloop) p = tornado.process.Subprocess(cmd, io_loop=self._ioloop)
p.set_exit_callback(partial(self.command_done, callbacks))
except OSError: except OSError:
logger.error('failed to run command.', exc_info=True) logger.error('failed to run command.', exc_info=True)
self.run_command()
else:
p.set_exit_callback(partial(self.command_done, callbacks))
def command_done(self, callbacks, status): def command_done(self, callbacks, status):
if status == 0: if status == 0: