Report progress of gclient sync during fetch.
Add an option to not store stdout when running commands unless it's needed.
R=agable@chromium.org
Bug: 722686
Change-Id: I402c83767097d53e588ba3e8bca89291712a572f
Reviewed-on: https://chromium-review.googlesource.com/888584
Reviewed-by: Aaron Gable <agable@chromium.org>
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
diff --git a/fetch.py b/fetch.py
index 5944140..67d219f 100755
--- a/fetch.py
+++ b/fetch.py
@@ -61,11 +61,15 @@
def sync(self):
pass
- def run(self, cmd, **kwargs):
+ def run(self, cmd, return_stdout=False, **kwargs):
print 'Running: %s' % (' '.join(pipes.quote(x) for x in cmd))
if self.options.dry_run:
return ''
- return subprocess.check_output(cmd, **kwargs)
+ if return_stdout:
+ return subprocess.check_output(cmd, **kwargs)
+ else:
+ subprocess.check_call(cmd, **kwargs)
+ return ''
class GclientCheckout(Checkout):
@@ -79,7 +83,7 @@
def exists(self):
try:
- gclient_root = self.run_gclient('root').strip()
+ gclient_root = self.run_gclient('root', return_stdout=True).strip()
return (os.path.exists(os.path.join(gclient_root, '.gclient')) or
os.path.exists(os.path.join(os.getcwd(), self.root)))
except subprocess.CalledProcessError: