You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
275 B
14 lines
275 B
1 year ago
|
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
|
||
|
|