From ac853fc354c414aaef66d7494b044483bc2ffce3 Mon Sep 17 00:00:00 2001 From: Justin Newberry Date: Thu, 21 Mar 2024 15:58:16 -0400 Subject: [PATCH] common/run: add environment variable argument (#31957) run add environment argument old-commit-hash: efc32c2930a7d85fbdd308e1d9110ff270e4667d --- common/run.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/run.py b/common/run.py index c1a36bf041..06deb6388d 100644 --- a/common/run.py +++ b/common/run.py @@ -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