Files
sunnypilot/common/run.py
Justin Newberry a5bc36ea9d move git commands to common/git.py (#31921)
move git into common/git.py
old-commit-hash: 4fbc8a3896
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