summaryrefslogtreecommitdiff
path: root/lorry
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2020-05-01 16:33:41 +0100
committerBen Hutchings <ben.hutchings@codethink.co.uk>2020-05-29 20:35:15 +0100
commit9953489966665b4cc21b12e0b9b37feff3e797a0 (patch)
tree87ea2effa259280b924011dfd2737a80298dcc73 /lorry
parentf8fbd3f1c94a1ca05b3f918141b30d036948a2ae (diff)
downloadlorry-9953489966665b4cc21b12e0b9b37feff3e797a0.tar.gz
lorry: Decode sub-command stdout and stderr to text
cliapp.Application.runcmd_unchecked returns bytes objects under Python 3. Decode these as UTF-8 in non-strict (replace) mode.
Diffstat (limited to 'lorry')
-rwxr-xr-xlorry4
1 files changed, 4 insertions, 0 deletions
diff --git a/lorry b/lorry
index 0cc5329..7505633 100755
--- a/lorry
+++ b/lorry
@@ -543,6 +543,10 @@ class Lorry(cliapp.Application):
logging.debug('Running: argv=%s kwargs=%s' %
(repr(argv), repr(kwargs)))
exit, out, err = self.runcmd_unchecked(argv, **kwargs)
+ if isinstance(out, bytes):
+ out = out.decode('utf-8', errors='replace')
+ if isinstance(err, bytes):
+ err = err.decode('utf-8', errors='replace')
logging.debug('Command: %s\nExit: %s\nStdout:\n%sStderr:\n%s' %
(argv, exit, self.indent(out or ''),
self.indent(err or '')))