From d8f740c6a88064f084241296a17583ae79d16bcb Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Thu, 9 Jul 2020 10:09:29 +0100 Subject: trivial: Improve logging of run commands Change-Id: I5ee1f506a162692fe2882651f7ab68afb441aacf Signed-off-by: Stephen Finucane --- pbr/tests/base.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pbr/tests/base.py b/pbr/tests/base.py index ea4a458..c94af56 100644 --- a/pbr/tests/base.py +++ b/pbr/tests/base.py @@ -202,12 +202,15 @@ def _run_cmd(args, cwd): :param cwd: The directory to run the comamnd in. :return: ((stdout, stderr), returncode) """ + print('Running %s' % ' '.join(args)) p = subprocess.Popen( args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd) streams = tuple(s.decode('latin1').strip() for s in p.communicate()) - for stream_content in streams: - print(stream_content) + print('STDOUT:') + print(streams[0]) + print('STDERR:') + print(streams[1]) return (streams) + (p.returncode,) -- cgit v1.2.1