From bd00e6f289a69badf7beea827b20764ed3252c7a Mon Sep 17 00:00:00 2001 From: "jose.lausuch" Date: Fri, 6 May 2016 01:36:30 +0200 Subject: CLI implementation JIRA: FUNCTEST-243 Change-Id: Ibf0ef9bcc5f3aeda96b050827b954ce060317613 Signed-off-by: jose.lausuch --- utils/functest_utils.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'utils/functest_utils.py') diff --git a/utils/functest_utils.py b/utils/functest_utils.py index 41925fc4..2d871615 100644 --- a/utils/functest_utils.py +++ b/utils/functest_utils.py @@ -213,16 +213,18 @@ def execute_command(cmd, logger=None, else: print(msg_exec) p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) - while p.poll() is None: - line = p.stdout.readline().rstrip() - if verbose: - if logger: - if info: - logger.info(line) - else: - logger.debug(line) + while True: + line = p.stdout.readline().replace('\n', '') + if not line: + break + if logger: + if info: + logger.info(line) else: - print line + logger.debug(line) + else: + print line + p.communicate() if p.returncode != 0: if verbose: if logger: -- cgit 1.2.3-korg