diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-05-01 16:33:41 +0100 |
---|---|---|
committer | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2020-05-29 20:35:15 +0100 |
commit | 9953489966665b4cc21b12e0b9b37feff3e797a0 (patch) | |
tree | 87ea2effa259280b924011dfd2737a80298dcc73 /lorry | |
parent | f8fbd3f1c94a1ca05b3f918141b30d036948a2ae (diff) | |
download | lorry-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-x | lorry | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -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 ''))) |