diff --git a/src/poetry/utils/shell.py b/src/poetry/utils/shell.py index d5b23288540..38457206b8b 100644 --- a/src/poetry/utils/shell.py +++ b/src/poetry/utils/shell.py @@ -108,9 +108,11 @@ def activate(self, env: VirtualEnv) -> int | None: # 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))}" - ) + cmd = f"{self._get_source_command()} {shlex.quote(str(activate_path))}" + if self._name == "fish": + # Under fish "\r" should be sent explicitly + cmd += "\r" + c.sendline(cmd) def resize(sig: Any, data: Any) -> None: terminal = shutil.get_terminal_size()