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.
This commit is contained in:
Paul Ferrell
2021-11-29 05:27:02 -07:00
committed by GitHub
parent bdde70c9d3
commit c0edb17b93
2 changed files with 24 additions and 1 deletions

View File

@@ -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