Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Unified Diff: lib/cros_build_lib.py

Issue 6877015: Add combine_stdout_stderr as well as make success less verbose. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/cros_build_lib.py
diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py
index 6f331a0b3b933e478a53c5e3c2d59be4ff34773e..46eed8b00b8e38d434d56e1bcbb9e9bf053a95f2 100644
--- a/lib/cros_build_lib.py
+++ b/lib/cros_build_lib.py
@@ -28,7 +28,7 @@ def GetCallerName():
def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
exit_code=False, redirect_stdout=False, redirect_stderr=False,
cwd=None, input=None, enter_chroot=False, num_retries=0,
- log_to_file=None):
+ log_to_file=None, combine_stdout_stderr=False):
"""Runs a shell command.
Arguments:
@@ -46,6 +46,8 @@ def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
cwd must point to the scripts directory.
num_retries: the number of retries to perform before dying
log_to_file: Redirects all stderr and stdout to file specified by this path.
+ combine_stdout_stderr: Combines stdout and stdin streams into stdout. Auto
dgarrett 2011/04/18 23:13:21 '. Auto' should be: '. Auto'
+ set to true if log_to_file specifies a file.
Returns:
If exit_code is True, returns the return code of the shell command.
@@ -71,6 +73,7 @@ def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
else:
if redirect_stdout: stdout = subprocess.PIPE
if redirect_stderr: stderr = subprocess.PIPE
+ if combine_stdout_stderr: stderr = subprocess.STDOUT
if input: stdin = subprocess.PIPE
if enter_chroot: cmd = ['./enter_chroot.sh', '--'] + cmd
@@ -107,10 +110,7 @@ def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
# If the command (and all retries) failed, handle error result
if proc.returncode != 0:
- if error_ok:
- Warning('Command "%r" failed.\n' % (cmd) +
- (error_message or error or output or ''))
- else:
+ if not error_ok:
dgarrett 2011/04/18 23:13:21 Might as well do this... if proc.returncode != 0
raise RunCommandException('Command "%r" failed.\n' % (cmd) +
(error_message or error or output or ''))
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698