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

Unified Diff: tools/cr/cr/base/host.py

Issue 131543004: Make cr build run goma_ctl.py ensure_start before building. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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
« tools/cr/cr/actions/ninja.py ('K') | « tools/cr/cr/actions/ninja.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cr/cr/base/host.py
diff --git a/tools/cr/cr/base/host.py b/tools/cr/cr/base/host.py
index c6e0ced86e6b3163e260b1da78f82bae2103b7f5..c6cb212980bc6badfbf86ed641d758916ecb85ad 100644
--- a/tools/cr/cr/base/host.py
+++ b/tools/cr/cr/base/host.py
@@ -41,8 +41,8 @@ class Host(cr.Plugin, cr.Plugin.Type):
return host
def _Execute(self, context, command,
- shell=False, capture=False, ignore_dry_run=False,
- return_status=False):
+ shell=False, capture=False, silent=False,
+ ignore_dry_run=False, return_status=False):
"""This is the only method that launches external programs.
It is a thin wrapper around subprocess.Popen that handles cr specific
@@ -78,6 +78,8 @@ class Host(cr.Plugin, cr.Plugin.Type):
out = None
if capture:
out = subprocess.PIPE
+ elif silent:
+ out = open(os.devnull, "w")
try:
p = subprocess.Popen(
command, shell=shell,
@@ -97,6 +99,9 @@ class Host(cr.Plugin, cr.Plugin.Type):
p.terminate()
p.wait()
exit(1)
+ finally:
+ if silent:
+ out.close()
if return_status:
return p.returncode
if p.returncode != 0:
@@ -115,6 +120,10 @@ class Host(cr.Plugin, cr.Plugin.Type):
return self._Execute(context, command, shell=False)
@cr.Plugin.activemethod
+ def ExecuteSilently(self, context, *command):
ian_cottrell 2014/01/09 17:00:21 For cases where I have wanted this, I just use cap
johnme 2014/01/09 19:06:11 It's (theoretically) slightly faster, and a little
+ return self._Execute(context, command, shell=False, silent=True)
+
+ @cr.Plugin.activemethod
def CaptureShell(self, context, *command):
return self._Execute(context, command,
shell=True, capture=True, ignore_dry_run=True)
« tools/cr/cr/actions/ninja.py ('K') | « tools/cr/cr/actions/ninja.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698