[lit] Adjust error handling for decode introduced by r374665
authorJoel E. Denny <jdenny.ornl@gmail.com>
Sat, 12 Oct 2019 16:25:46 +0000 (16:25 +0000)
committerJoel E. Denny <jdenny.ornl@gmail.com>
Sat, 12 Oct 2019 16:25:46 +0000 (16:25 +0000)
On that decode, Windows bots fail with:

```
UnicodeEncodeError: 'ascii' codec can't encode characters in position 7-8: ordinal not in range(128)
```

That's the same error as before r374665 except it's now at the decode
before the write to stdout.

llvm-svn: 374666

llvm/utils/lit/lit/builtin_commands/diff.py

index ee933d8..d851c4c 100644 (file)
@@ -97,7 +97,7 @@ def compareTwoTextFiles(flags, filepaths, filelines_bin, encoding):
                      n = flags.num_context_lines):
         if hasattr(diff, 'decode'):
             # python 2.7
-            diff = diff.decode()
+            diff = diff.decode(errors="backslashreplace")
         sys.stdout.write(diff)
         exitCode = 1
     return exitCode