diff --git a/src/poetry/utils/shell.py b/src/poetry/utils/shell.py index 7c9b23e58ee..d5b23288540 100644 --- a/src/poetry/utils/shell.py +++ b/src/poetry/utils/shell.py @@ -76,14 +76,13 @@ def activate(self, env: VirtualEnv) -> int | None: # mypy requires using sys.platform instead of WINDOWS constant # in if statements to properly type check on Windows if sys.platform == "win32": + args = None if self._name in ("powershell", "pwsh"): args = ["-NoExit", "-File", str(activate_path)] elif self._name == "cmd": # /K will execute the bat file and # keep the cmd process from terminating args = ["/K", str(activate_path)] - else: - args = None if args: completed_proc = subprocess.run([self.path, *args])