diff options
author | Daniel Schwierzeck <daniel.schwierzeck@gmail.com> | 2017-06-08 03:07:09 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-06-09 13:45:34 -0600 |
commit | aafbe82fb6ffc233f0db57b675c2577cf37c846b (patch) | |
tree | 70f5beb828fec67d41999fd42d50f6bdeb23b7b5 /tools | |
parent | b0e994c29e726dc0ba02a44adbd050f5f9f0b995 (diff) | |
download | u-boot-aafbe82fb6ffc233f0db57b675c2577cf37c846b.tar.gz |
buildman: properly translate strings for log and err files to ASCII
The build output can still produce unicode encoded output. But in
the buildman's log and err files we only want plain ASCII characters.
To handle all situations with unicode and non-unicode output, encode
the stdout and stderr strings to UTF-8 and afterwards to ASCII with
replacing all special characters.
Signed-off-by: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/buildman/builderthread.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index acaf5007f5..9e8ca80c5b 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -280,13 +280,15 @@ class BuilderThread(threading.Thread): outfile = os.path.join(build_dir, 'log') with open(outfile, 'w') as fd: if result.stdout: - fd.write(result.stdout.encode('latin-1', 'ignore')) + # We don't want unicode characters in log files + fd.write(result.stdout.decode('UTF-8').encode('ASCII', 'replace')) errfile = self.builder.GetErrFile(result.commit_upto, result.brd.target) if result.stderr: with open(errfile, 'w') as fd: - fd.write(result.stderr.encode('latin-1', 'ignore')) + # We don't want unicode characters in log files + fd.write(result.stderr.decode('UTF-8').encode('ASCII', 'replace')) elif os.path.exists(errfile): os.remove(errfile) |