4-variable-simplifier/python/run.py
2026-04-25 16:00:10 -04:00

26 lines
485 B
Python

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);