summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/dotest.py
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-11-04 01:03:47 +0000
committerZachary Turner <zturner@google.com>2015-11-04 01:03:47 +0000
commitbbc5b46a106b24a3e559dade0fe25729a515c6c4 (patch)
treed420578322457b2c2f4df0f0b1462f4a93007448 /lldb/packages/Python/lldbsuite/test/dotest.py
parent1c58d5ac9003a772d2a290f9758ed45a3f0aa53a (diff)
downloadbcm5719-llvm-bbc5b46a106b24a3e559dade0fe25729a515c6c4.tar.gz
bcm5719-llvm-bbc5b46a106b24a3e559dade0fe25729a515c6c4.zip
Python 3 - Use universal_newlines when calling subprocess.check_output
By default in Python 3, check_output() returns a program's output as an encoded byte sequence. This means it returns a Py3 `bytes` object, which cannot be compared to a string since it's a different fundamental type. Although it might not be correct from a purist standpoint, from a practical one we can assume that all output is encoded in the default locale, in which case using universal_newlines=True will decode it according to the current locale. Anyway, universal_newlines also has the nice behavior that it converts \r\n to \n on Windows platforms so this makes parsing code easier, should we need that. So it seems like a win/win. llvm-svn: 252025
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/dotest.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/dotest.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/dotest.py b/lldb/packages/Python/lldbsuite/test/dotest.py
index 181e26b6602..f6413de9834 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1147,7 +1147,7 @@ def setupSysPath():
# If our lldb supports the -P option, use it to find the python path:
init_in_python_dir = os.path.join('lldb', '__init__.py')
- lldb_dash_p_result = subprocess.check_output([lldbtest_config.lldbExec, "-P"], stderr=subprocess.STDOUT)
+ lldb_dash_p_result = subprocess.check_output([lldbtest_config.lldbExec, "-P"], stderr=subprocess.STDOUT, universal_newlines=True)
if lldb_dash_p_result and not lldb_dash_p_result.startswith(("<", "lldb: invalid option:")) \
and not lldb_dash_p_result.startswith("Traceback"):
OpenPOWER on IntegriCloud