buildroot: don't specify encoding for popen

Since low-level primitives (os.read) are used to read from the stdout
pipe, manual text decoding was necessary there anyway. The `encoding`
argument meant that we could forgo the manual decoding for the call
to `communicate`. But this meant that text handling is not uniform.
Therefore, remove the `encoding` argument from the `Popen` call and
manual decode all the text.
This commit is contained in:
Christian Kellner 2021-05-18 15:39:01 +00:00 committed by Tom Gundersen
parent 13e629ba72
commit 7f50d2b57f

View file

@ -235,7 +235,6 @@ class BuildRoot(contextlib.AbstractContextManager):
stdin=subprocess.DEVNULL,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding="utf-8",
close_fds=True)
data = io.StringIO()
@ -250,7 +249,8 @@ class BuildRoot(contextlib.AbstractContextManager):
data.write(txt)
monitor.log(txt)
txt, _ = proc.communicate()
buf, _ = proc.communicate()
txt = buf.decode("utf-8")
monitor.log(txt)
data.write(txt)
output = data.getvalue()