diff --git a/src/poetry/utils/shell.py b/src/poetry/utils/shell.py index 431879a52b4..45d002fec85 100644 --- a/src/poetry/utils/shell.py +++ b/src/poetry/utils/shell.py @@ -95,8 +95,13 @@ def activate(self, env: VirtualEnv) -> int | None: if self._name in ["zsh", "nu"]: c.setecho(False) - - c.sendline(f"{self._get_source_command()} {shlex.quote(str(activate_path))}") + if self._name == "zsh": + # Under ZSH the source command should be invoked in zsh's bash emulator + c.sendline(f"emulate bash -c '. {shlex.quote(str(activate_path))}'") + else: + c.sendline( + f"{self._get_source_command()} {shlex.quote(str(activate_path))}" + ) def resize(sig: Any, data: Any) -> None: terminal = shutil.get_terminal_size()