mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-06-20 09:12:05 +08:00
a5bc36ea9d
move git into common/git.py
old-commit-hash: 4fbc8a3896
14 lines
275 B
Python
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
|
|
|