Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/command.py
diff options
context:
space:
mode:
Diffstat (limited to 'devbot/command.py')
-rw-r--r--devbot/command.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/devbot/command.py b/devbot/command.py
index 9a8b5e2..aaef58f 100644
--- a/devbot/command.py
+++ b/devbot/command.py
@@ -1,16 +1,27 @@
import subprocess
import time
-def run(args, test=False, retry=0):
+_logger = None
+
+def set_logger(logger):
+ global _logger
+ _logger = logger
+
+def run(args, log=None, test=False, retry=0):
print " ".join(args)
if test:
return
+ full_args = args[:]
+ if log is not None:
+ full_args.insert(0, _logger)
+ full_args.append(log)
+
tries = 0
while tries < retry + 1:
try:
tries = tries + 1
- subprocess.check_call(args)
+ subprocess.check_call(full_args)
return
except subprocess.CalledProcessError, e:
if tries < retry + 1: