Commit 92dee360 by Bjorn Neergaard

fix(env): run Python inside environments in isolated mode

this avoids issues when `PYTHON*` environmental variables are set, and
prevents the CWD from being added to `sys.path` (and thus clobbering
stdlib names)
parent 89514fc6
...@@ -1475,7 +1475,9 @@ class Env: ...@@ -1475,7 +1475,9 @@ class Env:
return self._run(cmd, **kwargs) return self._run(cmd, **kwargs)
def run_python_script(self, content: str, **kwargs: Any) -> int | str: def run_python_script(self, content: str, **kwargs: Any) -> int | str:
return self.run(self._executable, "-W", "ignore", "-", input_=content, **kwargs) return self.run(
self._executable, "-I", "-W", "ignore", "-", input_=content, **kwargs
)
def _run(self, cmd: list[str], **kwargs: Any) -> int | str: def _run(self, cmd: list[str], **kwargs: Any) -> int | str:
""" """
......
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