mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
utils/misc: check_output: handle unset sys encoding
Default to assuming 'utf-8' encoding for environments where sys.stdout.encoding is not set.
This commit is contained in:
parent
e8a03e00f3
commit
df61b2a269
@ -183,9 +183,9 @@ def check_output(command, timeout=None, ignore=None, inputtext=None,
|
||||
output, error = process.communicate(inputtext)
|
||||
if sys.version_info[0] == 3:
|
||||
# Currently errors=replace is needed as 0x8c throws an error
|
||||
output = output.decode(sys.stdout.encoding, "replace")
|
||||
output = output.decode(sys.stdout.encoding or 'utf-8', "replace")
|
||||
if error:
|
||||
error = error.decode(sys.stderr.encoding, "replace")
|
||||
error = error.decode(sys.stderr.encoding or 'utf-8', "replace")
|
||||
finally:
|
||||
if timeout:
|
||||
timer.cancel()
|
||||
|
Loading…
x
Reference in New Issue
Block a user