mirror of https://github.com/1okko/openpilot.git
common/run: add environment variable argument (#31957)
run add environment argument
This commit is contained in:
parent
c3bbc58a85
commit
efc32c2930
|
@ -1,13 +1,13 @@
|
|||
import subprocess
|
||||
|
||||
|
||||
def run_cmd(cmd: list[str], cwd=None) -> str:
|
||||
return subprocess.check_output(cmd, encoding='utf8', cwd=cwd).strip()
|
||||
def run_cmd(cmd: list[str], cwd=None, env=None) -> str:
|
||||
return subprocess.check_output(cmd, encoding='utf8', cwd=cwd, env=env).strip()
|
||||
|
||||
|
||||
def run_cmd_default(cmd: list[str], default: str = "", cwd=None) -> str:
|
||||
def run_cmd_default(cmd: list[str], default: str = "", cwd=None, env=None) -> str:
|
||||
try:
|
||||
return run_cmd(cmd, cwd=cwd)
|
||||
return run_cmd(cmd, cwd=cwd, env=env)
|
||||
except subprocess.CalledProcessError:
|
||||
return default
|
||||
|
||||
|
|
Loading…
Reference in New Issue