PYTHON-5210 Prevent overriding the python used by other tools (#2203)
This commit is contained in:
parent
e6e8650cc9
commit
72ed1029be
@ -137,6 +137,11 @@ def run_command(cmd: str | list[str], **kwargs: Any) -> None:
|
||||
cmd = " ".join(cmd)
|
||||
LOGGER.info("Running command '%s'...", cmd)
|
||||
kwargs.setdefault("check", True)
|
||||
# Prevent overriding the python used by other tools.
|
||||
env = kwargs.pop("env", os.environ).copy()
|
||||
if "UV_PYTHON" in env:
|
||||
del env["UV_PYTHON"]
|
||||
kwargs["env"] = env
|
||||
try:
|
||||
subprocess.run(shlex.split(cmd), **kwargs) # noqa: PLW1510, S603
|
||||
except subprocess.CalledProcessError as e:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user