From: Alfredo Deza Date: Tue, 15 Dec 2015 19:31:28 +0000 (-0500) Subject: check both out and error for output before quiting X-Git-Tag: 0.0.26~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f9c8e87a8e3fc48bd122c86953ec87ac1be13a10;p=remoto.git check both out and error for output before quiting Signed-off-by: Alfredo Deza --- diff --git a/remoto/process.py b/remoto/process.py index 3dc7d5e..4791725 100644 --- a/remoto/process.py +++ b/remoto/process.py @@ -44,21 +44,21 @@ def _remote_run(channel, cmd, **kw): while True: for descriptor in reads: if descriptor == process.stdout.fileno(): - read = process.stdout.readline() - if read: - channel.send({'debug': read}) + out_read = process.stdout.readline() + if out_read: + channel.send({'debug': out_read}) sys.stdout.flush() if descriptor == process.stderr.fileno(): - read = process.stderr.readline() - if read: - channel.send({'warning': read}) + err_read = process.stderr.readline() + if err_read: + channel.send({'warning': err_read}) sys.stderr.flush() # At this point we have gone through all the possible # descriptors and `read` was empty, so we now can break out of # this since all stdout/stderr has been properly flushed to # logging - if not read: + if not err_read and not out_read: break break