Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xcommands/check-system7
-rw-r--r--commands/common.py6
-rw-r--r--devbot/command.py17
3 files changed, 19 insertions, 11 deletions
diff --git a/commands/check-system b/commands/check-system
index 63b86ed..4429d90 100755
--- a/commands/check-system
+++ b/commands/check-system
@@ -22,4 +22,9 @@ check_args = {"update": args.update,
"interactive": interactive,
"lazy": False}
-common.setup(log_name="check-system", check_args=check_args)
+setup_args = {"check_args": check_args}
+
+if not interactive:
+ setup_args["log_name"] = "check-system"
+
+common.setup(**setup_args)
diff --git a/commands/common.py b/commands/common.py
index 62b53b5..c09da54 100644
--- a/commands/common.py
+++ b/commands/common.py
@@ -16,8 +16,10 @@ def setup(log_name=None, check_args={}):
"state_dir": os.path.join(base_dir, "state"),
"prefs_path": os.path.join(base_dir, "prefs"),
"logs_dir": os.path.join(base_dir, "logs"),
- "relocatable": "SUGAR_BUILDBOT" in os.environ,
- "log_name": log_name}
+ "relocatable": "SUGAR_BUILDBOT" in os.environ}
+
+ if log_name:
+ config_args["log_name"] = log_name
if not main.setup(config_args, check_args):
sys.exit(1)
diff --git a/devbot/command.py b/devbot/command.py
index 050f809..0d9c809 100644
--- a/devbot/command.py
+++ b/devbot/command.py
@@ -9,18 +9,19 @@ def run(args, test=False, retry=0):
print " ".join(args)
return
+ log_file = None
+ subprocess_args = {"args": args}
+
if config.log_path:
- stdout = open(config.log_path, "a")
- stderr = subprocess.STDOUT
- else:
- stdout = None
- stderr = None
+ log_file = open(config.log_path, "a")
+ subprocess_args["stdout"] = log_file
+ subprocess_args["stderr"] = subprocess.STDOUT
tries = 0
while tries < retry + 1:
try:
tries = tries + 1
- subprocess.check_call(args, stdout=stdout, stderr=stderr)
+ subprocess.check_call(**subprocess_args)
break
except subprocess.CalledProcessError, e:
print "\nCommand failed, tail of %s\n" % config.log_path
@@ -33,8 +34,8 @@ def run(args, test=False, retry=0):
else:
raise e
- if stdout:
- stdout.close()
+ if log_file:
+ log_file.close()
def run_with_sudo(args, test=False, retry=0):