mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
ci: Fix missing sys.stdout.encoding in python2 runners
Regression in fed98cd6ad
This commit is contained in:
@ -81,10 +81,13 @@ def _decode_data(data):
|
|||||||
if isinstance(data, bytes):
|
if isinstance(data, bytes):
|
||||||
# convert bytes to string. This is a bit of a hack, we know that we want to log this
|
# convert bytes to string. This is a bit of a hack, we know that we want to log this
|
||||||
# later so encode to the stdout encoding with backslash escapes for anything non-encodable
|
# later so encode to the stdout encoding with backslash escapes for anything non-encodable
|
||||||
|
encoding = sys.stdout.encoding
|
||||||
|
if encoding is None:
|
||||||
|
encoding = 'ascii'
|
||||||
try:
|
try:
|
||||||
return data.decode(sys.stdout.encoding, "backslashreplace")
|
return data.decode(encoding, "backslashreplace")
|
||||||
except (UnicodeDecodeError, TypeError): # Python <3.5 doesn't support backslashreplace
|
except (UnicodeDecodeError, TypeError): # Python <3.5 doesn't support backslashreplace
|
||||||
return data.decode(sys.stdout.encoding, "replace")
|
return data.decode(encoding, "replace")
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user