Run Claude Code programmatically changedheadless
Nearest release: v2.1.283, published 4 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 25 Sep 2026 23:09 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 25 Sep 2026 23:37 UTC.
Upstream edited
Recorded here
Lines+5added
Lines−1removed
From line
77
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits24to this page, all time
### If the working directory is deleted
The whole hunk
from line 77, old and new numbered
/
from line 77
7777* **Running a command**: Claude Code records the command as killed in the session.
7878* **Waiting for an answer to a permission prompt**: if you send SIGTERM to the process, Claude Code leaves the prompt unanswered. If your program closes the session through the Agent SDK, the SDK ends Claude Code's input before sending any signal, and Claude Code cancels the prompt as soon as the input ends.
7979
80When you [resume the session](#continue-conversations), Claude Code continues the turn that SIGTERM left unfinished.
80When you [resume the session](#continue-conversations), Claude Code leaves the interrupted turn as it is, and your next prompt drives the conversation. To have Claude Code continue the interrupted turn on resume instead, set [`CLAUDE_CODE_RESUME_INTERRUPTED_TURN=1`](/docs/en/env-vars).
81
82### If the working directory is deleted
83
84If the working directory of a `claude -p` or Agent SDK session is deleted mid-session, the session keeps running. When a turn starts while the directory is missing, Claude Code emits a [warning message](/docs/en/agent-sdk/typescript#sdkinformationalmessage) in `stream-json` output, and shell commands fail until the directory exists again.
8185
8286## Examples
8387
No line in this hunk matches that.