[PATCH] sb/execute: Use a decoder that maintains state aross blocks

Frank Kühndel frank.kuehndel at embedded-brains.de
Thu Sep 29 13:14:17 UTC 2022


Hello Chris,

I reviewed this patch and I also tested it in the environment which made 
problems earlier. The UnicodeDecodeError disappeared. This patch is fine 
for me.

Many tanks for fix this issue.
Frank

On 9/29/22 12:59, chrisj at rtems.org wrote:
> From: Chris Johns<chrisj at rtems.org>
> 
> Update #4726
> ---
>   source-builder/sb/execute.py | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/source-builder/sb/execute.py b/source-builder/sb/execute.py
> index 3db9abc..bdab373 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':

-- 
embedded brains GmbH
Herr Frank KÜHNDEL
Dornierstr. 4
82178 Puchheim
Germany
email: frank.kuehndel at embedded-brains.de
phone:  +49-89-18 94 741 - 23
mobile: +49-176-15 22 06 - 11
fax:    +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/



More information about the devel mailing list