From 1e956d763f80d04134377aebe7e84580d7c633f7 Mon Sep 17 00:00:00 2001 From: Echolonius <273862755+Echolonius@users.noreply.github.com> Date: Fri, 31 Jul 2026 13:05:12 -0500 Subject: [PATCH] fix(transport): catch all TimeoutError variants in process termination escalation loop --- src/claude_agent_sdk/_internal/transport/subprocess_cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/claude_agent_sdk/_internal/transport/subprocess_cli.py b/src/claude_agent_sdk/_internal/transport/subprocess_cli.py index 2bfd4703..13192e09 100644 --- a/src/claude_agent_sdk/_internal/transport/subprocess_cli.py +++ b/src/claude_agent_sdk/_internal/transport/subprocess_cli.py @@ -891,14 +891,14 @@ async def close(self) -> None: try: with anyio.fail_after(5): await self._process.wait() - except TimeoutError: + except (TimeoutError, getattr(anyio, "TimeoutError", TimeoutError)): # Graceful shutdown timed out — force terminate with suppress(ProcessLookupError): self._process.terminate() try: with anyio.fail_after(5): await self._process.wait() - except TimeoutError: + except (TimeoutError, getattr(anyio, "TimeoutError", TimeoutError)): # SIGTERM handler blocked — force kill (SIGKILL) with suppress(ProcessLookupError): self._process.kill()