summaryrefslogtreecommitdiff
path: root/test/backtest.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2010-02-28 13:11:21 -0500
committerNed Batchelder <ned@nedbatchelder.com>2010-02-28 13:11:21 -0500
commit3e012725e07941841bb4213fa9bb8b56abd01f18 (patch)
tree3fc739794ec1d1063deedf6b6c09d4f2e1889fbc /test/backtest.py
parente7ccc57e7346011bb4f5911d4268ebd3e4393cfc (diff)
downloadpython-coveragepy-git-3e012725e07941841bb4213fa9bb8b56abd01f18.tar.gz
If the user's code calls sys.exit(), honor the request and exit with that status. Fixes issue #50.
Diffstat (limited to 'test/backtest.py')
-rw-r--r--test/backtest.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/backtest.py b/test/backtest.py
index 4460a78d..05a1e142 100644
--- a/test/backtest.py
+++ b/test/backtest.py
@@ -10,19 +10,19 @@ import os
try:
import subprocess
except ImportError:
- def run_command(cmd):
+ def run_command(cmd, status=0):
"""Run a command in a subprocess.
- Returns the exit code and the combined stdout and stderr.
+ Returns the exit status code and the combined stdout and stderr.
"""
_, stdouterr = os.popen4(cmd)
- return 0, stdouterr.read()
+ return status, stdouterr.read()
else:
- def run_command(cmd):
+ def run_command(cmd, status=0):
"""Run a command in a subprocess.
- Returns the exit code and the combined stdout and stderr.
+ Returns the exit status code and the combined stdout and stderr.
"""
@@ -30,7 +30,7 @@ else:
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT
)
- retcode = proc.wait()
+ status = proc.wait()
# Get the output, and canonicalize it to strings with newlines.
output = proc.stdout.read()
@@ -38,7 +38,7 @@ else:
output = output.decode('utf-8')
output = output.replace('\r', '')
- return retcode, output
+ return status, output
# No more execfile in Py3k
try: