forked from OSchip/llvm-project
[lldb/Test] Decode stdout and stderr in case it contains Unicode.
Lit's to_string will just return the string when it's a `str` instance, which in Python 2 can still contain UTF-8 characters. Differential revision: https://reviews.llvm.org/D76955
This commit is contained in:
parent
d3fdafae06
commit
2de52422ac
|
@ -110,6 +110,11 @@ class LLDBTest(TestFormat):
|
||||||
timeoutInfo = 'Reached timeout of {} seconds'.format(
|
timeoutInfo = 'Reached timeout of {} seconds'.format(
|
||||||
litConfig.maxIndividualTestTime)
|
litConfig.maxIndividualTestTime)
|
||||||
|
|
||||||
|
if sys.version_info.major == 2:
|
||||||
|
# In Python 2, string objects can contain Unicode characters.
|
||||||
|
out = out.decode('utf-8')
|
||||||
|
err = err.decode('utf-8')
|
||||||
|
|
||||||
output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
|
output = """Script:\n--\n%s\n--\nExit Code: %d\n""" % (
|
||||||
' '.join(cmd), exitCode)
|
' '.join(cmd), exitCode)
|
||||||
if timeoutInfo is not None:
|
if timeoutInfo is not None:
|
||||||
|
|
Loading…
Reference in New Issue