diff --git a/src/poetry/utils/shell.py b/src/poetry/utils/shell.py index caf08c82348..8f720962cdb 100644 --- a/src/poetry/utils/shell.py +++ b/src/poetry/utils/shell.py @@ -122,7 +122,8 @@ def activate(self, env: VirtualEnv) -> int | None: 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))}'") + quoted_activate_path = shlex.quote(str(activate_path)) + c.sendline(f"emulate bash -c {shlex.quote(f'. {quoted_activate_path}')}") elif self._name == "xonsh": c.sendline(f"vox activate {shlex.quote(str(env.path))}") elif self._name in ["nu", "fish"]: