sb/execute: Fix incremental decoder with --dry-run

Closes #4726
This commit is contained in:
Chris Johns 2022-09-30 17:01:20 +10:00
parent cfed1659a2
commit e04c84191b

View File

@ -182,7 +182,10 @@ class execute(object):
if trace_threads:
print('execute:_readthread: start')
if sys.stdout.encoding is not None:
decoder = codecs.getincrementaldecoder(sys.stdout.encoding)()
else:
decoder = None
count = 0
line = ''
try:
@ -202,7 +205,7 @@ class execute(object):
_output_line(line + '\n', exe, prefix, out, count)
break
# str and bytes are the same type in Python2
if type(data) is not str and type(data) is bytes:
if decoder is not None and type(data) is not str and type(data) is bytes:
data = decoder.decode(data)
last_ch = data[-1]
sd = (line + data).split('\n')