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

Unified Diff: subprocess2.py

Issue 6882127: Make subprocess2.check_call() compliant with subprocess.check_call(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
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 | « checkout.py ('k') | tests/subprocess2_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: subprocess2.py
diff --git a/subprocess2.py b/subprocess2.py
index acfe4a9a504e40648e5a0e488da7797b4858e282..4ba3c65abc864ad6a1dbe1b7fadab71d5cd9d20a 100644
--- a/subprocess2.py
+++ b/subprocess2.py
@@ -256,7 +256,7 @@ def call(args, **kwargs):
return communicate(args, **kwargs)[1]
-def check_call(args, **kwargs):
+def check_call_out(args, **kwargs):
"""Improved version of subprocess.check_call().
Returns (stdout, stderr), unlike subprocess.check_call().
@@ -268,6 +268,12 @@ def check_call(args, **kwargs):
return out
+def check_call(args, **kwargs):
+ """Emulate subprocess.check_call()."""
+ check_call_out(args, **kwargs)
+ return 0
+
+
def capture(args, **kwargs):
"""Captures stdout of a process call and returns it.
@@ -287,9 +293,9 @@ def capture(args, **kwargs):
def check_output(args, **kwargs):
- """Captures stdout of a process call and returns it.
+ """Emulates subprocess.check_output().
- Returns stdout.
+ Captures stdout of a process call and returns stdout only.
- Discards stderr. By default sets stderr=STDOUT.
- Throws if return code is not 0.
@@ -302,4 +308,4 @@ def check_output(args, **kwargs):
kwargs['stdout'] = PIPE
if kwargs.get('stderr') is None:
kwargs['stderr'] = STDOUT
- return check_call(args, **kwargs)[0]
+ return check_call_out(args, **kwargs)[0]
« no previous file with comments | « checkout.py ('k') | tests/subprocess2_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698