import subprocess; import shlex; def run(command): res = subprocess.run(command, check = 0); if res.returncode: print("This command failed!"); print("$ " + " ".join(map(shlex.quote, command))); exit(1); def print_and_run(command): print("\033[01;38;2;100;200;100m" + "$ " + " ".join(map(shlex.quote, command)) + "\033[0m"); res = subprocess.run(command, check = 0); if res.returncode: print("This command failed!"); exit(1);