[rtems-source-builder commit] sb/execute: Fix incremental decoder with --dry-run

Chris Johns chrisj at rtems.org
Fri Sep 30 20:19:00 UTC 2022


Module:    rtems-source-builder
Branch:    5
Commit:    af0f612c4656d556efcaa03119475ca6fbdc7928
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=af0f612c4656d556efcaa03119475ca6fbdc7928

Author:    Chris Johns <chrisj at rtems.org>
Date:      Fri Sep 30 17:01:20 2022 +1000

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

Closes #4734

---

 source-builder/sb/execute.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/source-builder/sb/execute.py b/source-builder/sb/execute.py
index f470aba..e3809ec 100755
--- a/source-builder/sb/execute.py
+++ b/source-builder/sb/execute.py
@@ -182,7 +182,10 @@ class execute(object):
 
             if trace_threads:
                 print('execute:_readthread: start')
-            decoder = codecs.getincrementaldecoder(sys.stdout.encoding)()
+            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')



More information about the vc mailing list