summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2022-09-29 20:57:56 +1000
committerChris Johns <chrisj@rtems.org>2022-09-30 09:23:35 +1000
commitddfcc320ab740cd6ac30d70aaff7987dda25ee7f (patch)
tree30f05b39ae83fd700f0c18a6aa7ba9a79cb63cf5
parentsb/version: Set top from external package (diff)
downloadrtems-source-builder-ddfcc320ab740cd6ac30d70aaff7987dda25ee7f.tar.bz2
sb/execute: Use a decoder that maintains state aross blocks
Update #4734
-rwxr-xr-xsource-builder/sb/execute.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/source-builder/sb/execute.py b/source-builder/sb/execute.py
index 06f9b7d..f470aba 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,7 @@ class execute(object):
if trace_threads:
print('execute:_readthread: start')
+ decoder = codecs.getincrementaldecoder(sys.stdout.encoding)()
count = 0
line = ''
try:
@@ -201,7 +203,7 @@ class execute(object):
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)
+ data = decoder.decode(data)
last_ch = data[-1]
sd = (line + data).split('\n')
if last_ch != '\n':