Decode message only if encoding is known

When python does not know the encoding of stdout, sys.stdout.encoding
is None.  Then calling decode(None) raises an exception.  We just
skip decoding when the encoding is unknown.
This commit is contained in:
Pau Gargallo 2016-01-20 12:06:17 +01:00
parent c8c55a8961
commit 05e2471555

View File

@ -265,7 +265,8 @@ def enqueue_output(out, queue):
def _log_buf(buf):
if not buf:
return
buf = buf.decode(sys.stdout.encoding)
if sys.stdout.encoding:
buf = buf.decode(sys.stdout.encoding)
buf = buf.rstrip()
lines = buf.splitlines()
for line in lines: