diff --git a/poetry/console/commands/env/info.py b/poetry/console/commands/env/info.py index 5f7f185419d..321df6422ba 100644 --- a/poetry/console/commands/env/info.py +++ b/poetry/console/commands/env/info.py @@ -60,7 +60,7 @@ def _display_complete_info(self, env: "Env") -> None: self.line("") - system_env = GenericEnv(env.base) + system_env = env.parent_env self.line("System") self.line( "\n".join( diff --git a/poetry/utils/env.py b/poetry/utils/env.py index c9f3a780401..4a6f42291ac 100644 --- a/poetry/utils/env.py +++ b/poetry/utils/env.py @@ -762,7 +762,7 @@ def remove(self, python: str) -> "Env": self.remove_venv(venv) - return VirtualEnv(venv) + return VirtualEnv(venv, venv) def create_venv( self, @@ -1741,6 +1741,21 @@ def get_paths(self) -> Dict[str, str]: return json.loads(output) + def execute(self, bin: str, *args: str, **kwargs: Any) -> Optional[int]: + command = self.get_command_from_bin(bin) + list(args) + env = kwargs.pop("env", {k: v for k, v in os.environ.items()}) + + if not self._is_windows: + return os.execvpe(command[0], command, env=env) + else: + exe = subprocess.Popen([command[0]] + command[1:], env=env, **kwargs) + exe.communicate() + + return exe.returncode + + def _run(self, cmd: List[str], **kwargs: Any) -> Optional[int]: + return super(VirtualEnv, self)._run(cmd, **kwargs) + def is_venv(self) -> bool: return self._path != self._base