diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-04-20 13:31:21 +0100 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2012-04-20 13:31:21 +0100 |
commit | 7b8588a0262dc79f0d2a2cf8d00dac4d70e70f07 (patch) | |
tree | 5c2c164413ace83906f7612ad81d5723ed7cf814 | |
parent | c84b5c726509c07c3a1803121cb21046a7987ac7 (diff) | |
download | morph-7b8588a0262dc79f0d2a2cf8d00dac4d70e70f07.tar.gz |
Always log output of commands executed, for easier build debugging
-rw-r--r-- | morphlib/execute.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/morphlib/execute.py b/morphlib/execute.py index fe4deb00..c3c331ee 100644 --- a/morphlib/execute.py +++ b/morphlib/execute.py @@ -97,13 +97,14 @@ class Execute(object): p = subprocess.Popen(argv, **kwargs) out, err = p.communicate(feed_stdin) + if _log: # pragma: no cover + logging.error('Exit code: %d' % p.returncode) + logging.error('Standard output:\n%s' % + morphlib.util.indent(out or '')) + logging.error('Standard error:\n%s' % + morphlib.util.indent(err or '')) if p.returncode != 0: - if _log: # pragma: no cover - logging.error('Exit code: %d' % p.returncode) - logging.error('Standard output:\n%s' % - morphlib.util.indent(out or '')) - logging.error('Standard error:\n%s' % - morphlib.util.indent(err or '')) raise CommandFailure(' '.join(argv), out) - return out + else: + return out |