From 8be37beabcbaef276a45a44ff94c8ea293c3f05a Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Mon, 14 Jan 2013 10:21:34 +0000 Subject: Don't use logs for check-system when running out of buildbot It's interactive so it needs stdin. --- (limited to 'devbot') 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): -- cgit v0.9.1