More interactive verbose calls

This commit is contained in:
mpeterv 2015-10-26 15:27:50 +03:00
parent 37e14a1abe
commit 741231af89

View File

@ -51,18 +51,20 @@ def space_cat(*args):
def run_command(verbose, *args): def run_command(verbose, *args):
command = space_cat(*args) command = space_cat(*args)
runner = subprocess.check_output
if verbose: if verbose:
print("Running " + command) print("Running " + command)
runner = subprocess.check_call
try: try:
output = subprocess.check_output(command, stderr=subprocess.STDOUT, shell=True) runner(command, stderr=subprocess.STDOUT, shell=True)
except subprocess.CalledProcessError as exception: except subprocess.CalledProcessError as exception:
sys.exit("Error: got exitcode {} from command {}\nOutput:\n{}".format( if not verbose:
exception.returncode, command, exception.output)) sys.stdout.write(exception.output)
if verbose and output: sys.exit("Error: got exitcode {} from command {}\n".format(
sys.stdout.write(output) exception.returncode, command))
lua_versions = ([ lua_versions = ([
"5.1", "5.1.1", "5.1.2", "5.1.3", "5.1.4", "5.1.5", "5.1", "5.1.1", "5.1.2", "5.1.3", "5.1.4", "5.1.5",