diff options
Diffstat (limited to 'lldb/lit/tools/lldb-mi/target/inputs/target-select-so-path.py')
| -rw-r--r-- | lldb/lit/tools/lldb-mi/target/inputs/target-select-so-path.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/lit/tools/lldb-mi/target/inputs/target-select-so-path.py b/lldb/lit/tools/lldb-mi/target/inputs/target-select-so-path.py index 834a1ed4071..5eb07d84237 100644 --- a/lldb/lit/tools/lldb-mi/target/inputs/target-select-so-path.py +++ b/lldb/lit/tools/lldb-mi/target/inputs/target-select-so-path.py @@ -1,5 +1,3 @@ -#!/usr/bin/env python2 - import os import sys import subprocess @@ -9,6 +7,10 @@ from threading import Timer hostname = 'localhost' (r, w) = os.pipe() +kwargs = {} +if sys.version_info >= (3,2): + kwargs['pass_fds'] = [w] + args = sys.argv # Get debugserver, lldb-mi and FileCheck executables' paths with arguments. debugserver = ' '.join([args[1], '--pipe', str(w), hostname + ':0']) @@ -17,14 +19,14 @@ test_file = args[3] filecheck = 'FileCheck ' + test_file # Run debugserver, lldb-mi and FileCheck. -debugserver_proc = subprocess.Popen(debugserver.split()) +debugserver_proc = subprocess.Popen(debugserver.split(), **kwargs) lldbmi_proc = subprocess.Popen(lldbmi, stdin=subprocess.PIPE, stdout=subprocess.PIPE, shell=True) filecheck_proc = subprocess.Popen(filecheck, stdin=subprocess.PIPE, shell=True) timeout_sec = 30 -timer = Timer(timeout_sec, lldbmi_proc.kill) +timer = Timer(timeout_sec, exit, [filecheck_proc.returncode]) try: timer.start() @@ -37,9 +39,10 @@ try: with open(test_file, 'r') as f: # Replace '$PORT' with a free port number and pass # test's content to lldb-mi. - lldbmi_proc.stdin.write(f.read().replace('$PORT', port)) + lldbmi_proc.stdin.write(f.read().replace('$PORT', port).encode('utf-8')) out, err = lldbmi_proc.communicate() filecheck_proc.stdin.write(out) + filecheck_proc.communicate() finally: timer.cancel() |

