Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/devbot/command.py
diff options
context:
space:
mode:
authorDaniel Narvaez <dwnarvaez@gmail.com>2012-11-28 10:37:06 (GMT)
committer Daniel Narvaez <dwnarvaez@gmail.com>2012-11-28 10:37:06 (GMT)
commita3335caea2879bea7d62d51a9a44e1340005293b (patch)
treeab24250a49def67a01e4cb37ef6fd00c68c27d61 /devbot/command.py
parent7265563b8bb9fb9e74b5564fdc5dde5b7d68594a (diff)
More generic logging approach
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: