Skip to content

Commit

Permalink
fix(env): run Python inside environments in isolated mode
Browse files Browse the repository at this point in the history
this avoids issues when `PYTHON*` environmental variables are set, and
prevents the CWD from being added to `sys.path` (and thus clobbering
stdlib names)
  • Loading branch information
neersighted committed Sep 28, 2022
1 parent 89514fc commit cddfebd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/poetry/utils/env.py
Expand Up @@ -1475,7 +1475,9 @@ def run_pip(self, *args: str, **kwargs: Any) -> int | str:
return self._run(cmd, **kwargs)

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:
"""
Expand Down

0 comments on commit cddfebd

Please sign in to comment.