summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/execute.py
diff options
context:
space:
mode:
Diffstat (limited to 'source-builder/sb/execute.py')
-rwxr-xr-xsource-builder/sb/execute.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/source-builder/sb/execute.py b/source-builder/sb/execute.py
index 3db9abc..b491c47 100755
--- a/source-builder/sb/execute.py
+++ b/source-builder/sb/execute.py
@@ -27,6 +27,7 @@
from __future__ import print_function
import functools
+import codecs
import io
import os
import re
@@ -181,6 +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:
@@ -200,8 +205,8 @@ 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:
- data = data.decode(sys.stdout.encoding)
+ 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')
if last_ch != '\n':