From 741231af897c857498f9059a36f5501b97b32e2b Mon Sep 17 00:00:00 2001 From: mpeterv Date: Mon, 26 Oct 2015 15:27:50 +0300 Subject: [PATCH] More interactive verbose calls --- hererocks.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hererocks.py b/hererocks.py index 4099ee8..3de50c5 100755 --- a/hererocks.py +++ b/hererocks.py @@ -51,18 +51,20 @@ def space_cat(*args): def run_command(verbose, *args): command = space_cat(*args) + runner = subprocess.check_output if verbose: print("Running " + command) + runner = subprocess.check_call try: - output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) + runner(command, stderr=subprocess.STDOUT, shell=True) except subprocess.CalledProcessError as exception: - sys.exit("Error: got exitcode {} from command {}\nOutput:\n{}".format( - exception.returncode, command, exception.output)) + if not verbose: + sys.stdout.write(exception.output) - if verbose and output: - sys.stdout.write(output) + sys.exit("Error: got exitcode {} from command {}\n".format( + exception.returncode, command)) lua_versions = ([ "5.1", "5.1.1", "5.1.2", "5.1.3", "5.1.4", "5.1.5",