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
This commit is contained in:
maruel@chromium.org
2010-01-30 22:31:50 +00:00
parent 519a8dd376
commit 7be5ef2ed0
5 changed files with 23 additions and 21 deletions

View File

@@ -28,12 +28,13 @@ import xml.parsers.expat
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 @@ def CheckCall(command, cwd=None, print_error=True):
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):