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

Unified Diff: build/android/pylib/cmd_helper.py

Issue 1258303003: [Android] Suppress findbugs stderr output. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 4 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 | « build/android/findbugs_diff.py ('k') | build/android/pylib/utils/findbugs.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/pylib/cmd_helper.py
diff --git a/build/android/pylib/cmd_helper.py b/build/android/pylib/cmd_helper.py
index 1c2e9d94f0bf8b618f4357d26b59dc181e98add2..8f3708bead2aad96d1c21295c63c26f098605860 100644
--- a/build/android/pylib/cmd_helper.py
+++ b/build/android/pylib/cmd_helper.py
@@ -145,17 +145,35 @@ def GetCmdStatusAndOutput(args, cwd=None, shell=False):
Returns:
The 2-tuple (exit code, output).
"""
- _ValidateAndLogCommand(args, cwd, shell)
- pipe = Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
- shell=shell, cwd=cwd)
- stdout, stderr = pipe.communicate()
+ status, stdout, stderr = GetCmdStatusOutputAndError(
+ args, cwd=cwd, shell=shell)
if stderr:
logging.critical(stderr)
if len(stdout) > 4096:
logging.debug('Truncated output:')
logging.debug(stdout[:4096])
- return (pipe.returncode, stdout)
+ return (status, stdout)
+
+def GetCmdStatusOutputAndError(args, cwd=None, shell=False):
+ """Executes a subprocess and returns its exit code, output, and errors.
+
+ Args:
+ args: A string or a sequence of program arguments. The program to execute is
+ the string or the first item in the args sequence.
+ cwd: If not None, the subprocess's current directory will be changed to
+ |cwd| before it's executed.
+ shell: Whether to execute args as a shell command. Must be True if args
+ is a string and False if args is a sequence.
+
+ Returns:
+ The 2-tuple (exit code, output).
+ """
+ _ValidateAndLogCommand(args, cwd, shell)
+ pipe = Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ shell=shell, cwd=cwd)
+ stdout, stderr = pipe.communicate()
+ return (pipe.returncode, stdout, stderr)
class TimeoutError(Exception):
« no previous file with comments | « build/android/findbugs_diff.py ('k') | build/android/pylib/utils/findbugs.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698