PY3: decode subprocess output if it's bytes

Otherwise, the logger will cause errors for the output.

Change-Id: I4379dba7629cfc0d928c1adda587ca400a38d227
This commit is contained in:
Kota Tsuyuzaki 2019-11-06 10:38:32 +09:00 committed by Tim Burke
parent 89fd96b9ff
commit c72226b654

View File

@ -319,8 +319,12 @@ class RunTimeSandbox(object):
stdout, stderr = proc.communicate()
if stdout:
if not isinstance(stdout, str):
stdout = stdout.decode("utf-8")
self.logger.debug('STDOUT: %s' % stdout.replace('\n', '#012'))
if stderr:
if not isinstance(stderr, str):
stderr = stderr.decode("utf-8")
self.logger.error('STDERR: %s' % stderr.replace('\n', '#012'))
if proc.returncode: