Commit e25d7845 by Arun Babu Neelicattu

env: do not modify os.environ

Replace updates of os.environ with explicit passing of `env` to
subprocess calls in `Env.execute()`.

Relates-to: #3199
parent 341f04e3
......@@ -1230,6 +1230,7 @@ class Env:
"""
call = kwargs.pop("call", False)
input_ = kwargs.pop("input_", None)
env = kwargs.pop("env", {k: v for k, v in os.environ.items()})
try:
if self._is_windows:
......@@ -1248,10 +1249,10 @@ class Env:
**kwargs,
).stdout
elif call:
return subprocess.call(cmd, stderr=subprocess.STDOUT, **kwargs)
return subprocess.call(cmd, stderr=subprocess.STDOUT, env=env, **kwargs)
else:
output = subprocess.check_output(
cmd, stderr=subprocess.STDOUT, **kwargs
cmd, stderr=subprocess.STDOUT, env=env, **kwargs
)
except CalledProcessError as e:
raise EnvCommandError(e, input=input_)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment