aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2020-11-20 09:07:03 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2020-12-27 13:55:33 +0100
commit414aee63285585e94bbb8d10c26f0aceb7fa60ca (patch)
tree485d9cddad927401797eb212bd44f67feba35745
parent2201e2bca66603a33d0341a11427f09872eddfcf (diff)
downloadmeson-414aee63285585e94bbb8d10c26f0aceb7fa60ca.zip
meson-414aee63285585e94bbb8d10c26f0aceb7fa60ca.tar.gz
meson-414aee63285585e94bbb8d10c26f0aceb7fa60ca.tar.bz2
mtest: use backslash replace when printing error logs
If there's an UnicodeEncodeError while printing the error logs, TestHarness tries an encode/decode pair to get rid of anything that is not a 7-bit ASCII character; this however results in "?" characters that are not very clear. To make it easier to understand what is going on, use backslashreplace instead. While at it, fix the decode to use a matching encoding. This will only matter in the rare case of sys.stdout.encoding not being an ASCII superset, but that should not matter. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/mtest.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/mesonbuild/mtest.py b/mesonbuild/mtest.py
index b8db80d..acd3612 100644
--- a/mesonbuild/mtest.py
+++ b/mesonbuild/mtest.py
@@ -1050,7 +1050,7 @@ class TestHarness:
try:
print(line)
except UnicodeEncodeError:
- line = line.encode('ascii', errors='replace').decode()
+ line = line.encode('ascii', errors='backslashreplace').decode('ascii')
print(line)
def total_failure_count(self) -> int: