Change CheckCall behavior when print_error=False
We now return the stderr half of the tuple.
This required a clean up of any usage of CheckCall and GIT.Capture.
Patch contributed by Nasser Grainawi <nasser@codeaurora.org>
Review URL: http://codereview.chromium.org/551215
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@37650 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index 3c62afb..e08bf8e 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -28,12 +28,13 @@
class CheckCallError(OSError):
"""CheckCall() returned non-0."""
- def __init__(self, command, cwd, retcode, stdout):
- OSError.__init__(self, command, cwd, retcode, stdout)
+ def __init__(self, command, cwd, retcode, stdout, stderr=None):
+ OSError.__init__(self, command, cwd, retcode, stdout, stderr)
self.command = command
self.cwd = cwd
self.retcode = retcode
self.stdout = stdout
+ self.stderr = stderr
def CheckCall(command, cwd=None, print_error=True):
@@ -50,12 +51,12 @@
shell=sys.platform.startswith('win'),
stdout=subprocess.PIPE,
stderr=stderr)
- output = process.communicate()[0]
+ std_out, std_err = process.communicate()
except OSError, e:
raise CheckCallError(command, cwd, e.errno, None)
if process.returncode:
- raise CheckCallError(command, cwd, process.returncode, output)
- return output
+ raise CheckCallError(command, cwd, process.returncode, std_out, std_err)
+ return std_out, std_err
def SplitUrlRevision(url):