[Lldb-commits] [PATCH] D76955: [lldb/Test] Decode stdout and stderr in case it contains UTF-8

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 27 14:52:59 PDT 2020


JDevlieghere updated this revision to Diff 253229.
JDevlieghere added a comment.

Use single quotes for consistency


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D76955/new/

https://reviews.llvm.org/D76955

Files:
  lldb/test/API/lldbtest.py


Index: lldb/test/API/lldbtest.py
===================================================================
--- lldb/test/API/lldbtest.py
+++ lldb/test/API/lldbtest.py
@@ -82,7 +82,7 @@
                     sys.executable,
                     '-c',
                     'import sys; print(sys.executable)'
-                ]).decode('utf-8').strip()
+                ]).decode('utf-8', errors='ignore').strip()
                 shutil.copy(python, copied_python)
             cmd[0] = copied_python
 
@@ -99,6 +99,10 @@
             timeoutInfo = 'Reached timeout of {} seconds'.format(
                 litConfig.maxIndividualTestTime)
 
+        # Decode stdout and stderr as it might contains UTF-8 characters.
+        out = out.decode('utf-8', errors='ignore')
+        err = err.decode('utf-8', errors='ignore')
+
         output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
             ' '.join(cmd), exitCode)
         if timeoutInfo is not None:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76955.253229.patch
Type: text/x-patch
Size: 954 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200327/4e294c9a/attachment.bin>


More information about the lldb-commits mailing list