summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Ferrell <51765748+Paul-Ferrell@users.noreply.github.com>2021-11-29 05:27:02 -0700
committerMassimiliano Culpo <massimiliano.culpo@gmail.com>2021-12-23 16:02:09 +0100
commit9d4291e590b304164598f32f63a8afbd6a2f2ec0 (patch)
tree3933f0d39b6aa8e5d99686a82c686fff0241d510
parent8f98f1d1820970a72b64000cc5003006f0a9b945 (diff)
downloadspack-9d4291e590b304164598f32f63a8afbd6a2f2ec0.tar.gz
spack-9d4291e590b304164598f32f63a8afbd6a2f2ec0.tar.bz2
spack-9d4291e590b304164598f32f63a8afbd6a2f2ec0.tar.xz
spack-9d4291e590b304164598f32f63a8afbd6a2f2ec0.zip
Handle byte sequences which are not encoded as UTF8 while logging. (#21447)
Fix builds which produce a lines with non-UTF8 output while logging The alternative is to read in binary mode, and then decode while ignoring errors.
-rw-r--r--lib/spack/llnl/util/tty/log.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/tty/log.py b/lib/spack/llnl/util/tty/log.py
index efcd487f23..a7a4637ba9 100644
--- a/lib/spack/llnl/util/tty/log.py
+++ b/lib/spack/llnl/util/tty/log.py
@@ -780,7 +780,12 @@ def _writer_daemon(stdin_multiprocess_fd, read_multiprocess_fd, write_fd, echo,
try:
while line_count < 100:
# Handle output from the calling process.
- line = _retry(in_pipe.readline)()
+ try:
+ line = _retry(in_pipe.readline)()
+ except UnicodeDecodeError:
+ # installs like --test=root gpgme produce non-UTF8 logs
+ line = '<line lost: output was not encoded as UTF-8>\n'
+
if not line:
return
line_count += 1