Files
dragonpilot/common/run.py
Justin Newberry 4fbc8a3896 move git commands to common/git.py (#31921)
move git into common/git.py
2024-03-19 12:39:09 -07:00

14 lines
275 B
Python

import subprocess
def run_cmd(cmd: list[str]) -> str:
return subprocess.check_output(cmd, encoding='utf8').strip()
def run_cmd_default(cmd: list[str], default: str = "") -> str:
try:
return run_cmd(cmd)
except subprocess.CalledProcessError:
return default