Skip to content

feat(transport): expose subprocess PID for external cleanup#818

Open
SAY-5 wants to merge 1 commit intoanthropics:mainfrom
SAY-5:feat/expose-subprocess-pid
Open

feat(transport): expose subprocess PID for external cleanup#818
SAY-5 wants to merge 1 commit intoanthropics:mainfrom
SAY-5:feat/expose-subprocess-pid

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented Apr 15, 2026

Per anthropics/anthropic-sdk-python#1370, callers that need to forcibly clean up the spawned claude CLI process (timeouts, hard shutdowns, parent-process cleanup) currently have to walk async generator internals to find the process, which is fragile and depends on SDK private state.

This PR adds a public pid property on SubprocessCLITransport that returns the underlying process PID, or None if no process is currently running. The existing close() already implements the graceful-shutdown → SIGTERM → SIGKILL escalation requested in the issue, so this PR only adds the PID accessor.

Closes anthropics/anthropic-sdk-python#1370

Per anthropics/anthropic-sdk-python#1370, callers that need to
forcibly clean up the spawned `claude` CLI process (timeouts, hard
shutdowns, parent-process cleanup) currently have to walk async
generator internals to find the process, which is fragile and
depends on SDK private state.

Add a public `pid` property on `SubprocessCLITransport` that
returns the underlying process PID, or `None` if no process is
currently running. The existing `close()` already implements the
graceful-shutdown → SIGTERM → SIGKILL escalation requested in the
issue, so this PR only adds the PID accessor.

Closes anthropics/anthropic-sdk-python#1370
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: expose subprocess PID from SubprocessCLITransport for cleanup

1 participant