-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow passage of stderr handle in run_and_print
allow passage of stderr handle in run_and_print, defaulting to stdout redirection as before if not specified
- Loading branch information
Showing
3 changed files
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,6 +229,9 @@ def run_and_print(args, stdout=None, stderr=None, | |
This is useful for nose, which has difficulty capturing stdout of | ||
subprocess invocations. | ||
''' | ||
|
||
stderr = stderr or subprocess.STDOUT | ||
This comment has been minimized.
Sorry, something went wrong.
notestaff
Contributor
|
||
|
||
if loglevel: | ||
silent = False | ||
if not buffered: | ||
|
@@ -238,7 +241,7 @@ def run_and_print(args, stdout=None, stderr=None, | |
args, | ||
stdin=stdin, | ||
stdout=subprocess.PIPE, | ||
stderr=subprocess.STDOUT, | ||
stderr=stderr, | ||
env=env, | ||
cwd=cwd, | ||
timeout=timeout, | ||
|
@@ -268,7 +271,7 @@ def run_and_print(args, stdout=None, stderr=None, | |
raise(e) | ||
else: | ||
result = run(args, stdin=stdin, stdout=subprocess.PIPE, | ||
stderr=subprocess.STDOUT, env=env, cwd=cwd, | ||
stderr=stderr, env=env, cwd=cwd, | ||
timeout=timeout, check=check) | ||
if not silent and not loglevel: | ||
print(result.stdout.decode('utf-8')) | ||
|
@@ -281,7 +284,7 @@ def run_and_print(args, stdout=None, stderr=None, | |
'CompletedProcess', ['args', 'returncode', 'stdout', 'stderr']) | ||
|
||
process = subprocess.Popen(args, stdin=stdin, stdout=subprocess.PIPE, | ||
stderr=subprocess.STDOUT, env=env, | ||
stderr=stderr, env=env, | ||
cwd=cwd) | ||
output = [] | ||
while process.poll() is None: | ||
|
@tomkinsc py27 doesn't have subprocess.DEVNULL .