From 1550a660f06ff82e853e8a814f0bcdf69e36086e Mon Sep 17 00:00:00 2001 From: topilski Date: Tue, 7 Mar 2017 14:09:27 +0300 Subject: [PATCH] Fix process read --- base/run_command.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/base/run_command.py b/base/run_command.py index d6f61e0..7f6230d 100644 --- a/base/run_command.py +++ b/base/run_command.py @@ -109,13 +109,9 @@ def run_command_cb(cmd, policy): try: policy.update_progress_message(0.0, 'Command {0} started'.format(cmd)) process = subprocess.Popen(cmd, stdout=subprocess.PIPE) - while True: - output = process.stdout.readline() - if output == '' and process.poll() is not None: - break - if output: - line = output.strip() - policy.process(Message(line, MessageType.MESSAGE)) + for output in process.stdout: + line = output.strip() + policy.process(Message(line.decode("utf-8"), MessageType.MESSAGE)) rc = process.poll() policy.update_progress_message(100.0, 'Command {0} finished successfully'.format(cmd)) except subprocess.CalledProcessError as ex: