mirror of
https://github.com/ARM-software/devlib.git
synced 2025-04-18 15:50:04 +01: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)
|
output, error = process.communicate(inputtext)
|
||||||
if sys.version_info[0] == 3:
|
if sys.version_info[0] == 3:
|
||||||
# Currently errors=replace is needed as 0x8c throws an error
|
# 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:
|
if error:
|
||||||
error = error.decode(sys.stderr.encoding, "replace")
|
error = error.decode(sys.stderr.encoding or 'utf-8', "replace")
|
||||||
finally:
|
finally:
|
||||||
if timeout:
|
if timeout:
|
||||||
timer.cancel()
|
timer.cancel()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user