summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-17 10:38:35 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-17 10:38:35 (GMT)
commit798d7fbad45a6e2e2d8f58de27665a4a8e63ecae (patch)
tree59c3f94974c320148940e679b11da85e8d9ee7b0
parent435eaf4422c50a37594d4c2d6ba46317c7e102fa (diff)
parent7e6977a8bc5c5209d22241933b6a1d5116de4121 (diff)
downloadcpython-798d7fbad45a6e2e2d8f58de27665a4a8e63ecae.zip
cpython-798d7fbad45a6e2e2d8f58de27665a4a8e63ecae.tar.gz
cpython-798d7fbad45a6e2e2d8f58de27665a4a8e63ecae.tar.bz2
Merge 3.5 (script_helper)
-rw-r--r--Lib/test/support/script_helper.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/support/script_helper.py b/Lib/test/support/script_helper.py
index c45d010..80889b1 100644
--- a/Lib/test/support/script_helper.py
+++ b/Lib/test/support/script_helper.py
@@ -83,16 +83,16 @@ def run_python_until_end(*args, **env_vars):
env = {}
env.update(env_vars)
cmd_line.extend(args)
- p = subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
+ proc = subprocess.Popen(cmd_line, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
env=env)
- try:
- out, err = p.communicate()
- finally:
- subprocess._cleanup()
- p.stdout.close()
- p.stderr.close()
- rc = p.returncode
+ with proc:
+ try:
+ out, err = proc.communicate()
+ finally:
+ proc.kill()
+ subprocess._cleanup()
+ rc = proc.returncode
err = strip_python_stderr(err)
return _PythonRunResult(rc, out, err), cmd_line