Commit ffe96f07 authored by maruel@chromium.org's avatar maruel@chromium.org

Fix default cwd value and the timing of the result code check

Review URL: http://codereview.chromium.org/474002

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@34166 0039d316-1c4b-4281-b951-d872f2087c98
parent 82f2c08a
......@@ -187,6 +187,8 @@ class GitWrapper(SCMWrapper, scm.GIT):
def _Run(self, args, cwd=None, checkrc=True, redirect_stdout=True):
# TODO(maruel): Merge with Capture?
if cwd is None:
cwd = self.checkout_path
stdout=None
if redirect_stdout:
stdout=subprocess.PIPE
......@@ -195,10 +197,10 @@ class GitWrapper(SCMWrapper, scm.GIT):
cmd = [self.COMMAND]
cmd.extend(args)
sp = subprocess.Popen(cmd, cwd=cwd, stdout=stdout)
output = sp.communicate()[0]
if checkrc and sp.returncode:
raise gclient_utils.Error('git command %s returned %d' %
(args[0], sp.returncode))
output = sp.communicate()[0]
if output is not None:
return output.strip()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment