This function wasn't showing anything for some commands,
like 'rally show images' and 'rally show flavors'
JIRA: FUNCTEST-348
Change-Id: I75bf5f3504ea8ffea42c2fb237d6863c655259e1
Signed-off-by: jose.lausuch <jose.lausuch@ericsson.com>
else:
print(msg_exec)
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
- while True:
- output = p.stdout.readline()
- line = output.replace('\n', '')
- if not line:
- break
+ for line in iter(p.stdout.readline, b''):
+ line = line.replace('\n', '')
if logger:
if info:
logger.info(line)
logger.debug(line)
else:
print line
- p.communicate()
- if p.returncode != 0:
+ p.stdout.close()
+ returncode = p.wait()
+ if returncode != 0:
if verbose:
if logger:
logger.error(error_msg)
if exit_on_error:
sys.exit(1)
- return p.returncode
+ return returncode
def get_deployment_dir(logger=None):