From 9953489966665b4cc21b12e0b9b37feff3e797a0 Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 1 May 2020 16:33:41 +0100 Subject: 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. --- lorry | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lorry') 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 ''))) -- cgit v1.2.1