AIToday
Large Language ModelsAI Coding AssistantsZenn AI/MLPublished: Nov 29, 2026, 10:01 JST

Claude Code 2.1.319: SIGINT-stopped claude -p exits 0, not 130

Send on LINE
Claude Code 2.1.319: SIGINT-stopped claude -p exits 0, not 130

3 Key Points

  1. What happened

    On Claude Code 2.1.319 (macOS 26.3), a SIGINT-stopped claude -p returned exit code 0 in 0.01 seconds across all five runs, while SIGTERM returned 143.

  2. Why it matters

    A run that was deliberately halted still looks successful to anything judging by exit code, so code that counts completion that way will overstate finished work; the author's own test double returned 130 and hid the mismatch.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, every morning.

By signing up you agree to the Terms of Service and Privacy Policy.

Context & Analysis

The author built an agent platform that runs claude -p as a child process and treats long runs as stopped by sending a signal. Reviewing autonomous-run logs, they noticed a run they had stopped carried exit code 0, while their test double returned 130 in the same situation. That mismatch prompted a direct experiment without the platform: Claude Code 2.1.319 on macOS 26.3, haiku, no tools, one turn, the child started in its own process group, and the signal sent one second after the first event.

The measured table shows SIGINT runs ending on their own in 0.01 seconds with exit code 0, and SIGTERM runs returning 143, both after only a system/init event. The author notes that official documentation mentions 143 for SIGTERM but does not document SIGINT's exit code, and says they do not know why 0 appears because they have not read Claude Code's internals. The result event differed between calls: the platform's invocation produced none, while the standalone script produced error_during_execution three times, and the author has not pinned down which argument causes that.

Because of that, the practical rule they land on does not depend on exit code at all: record on the stopping side that a stop happened, and count a run as finished only when a success result event appears. They added two tests with a 0-exiting double, one without a result event and one emitting a success result, and confirmed those tests fail when the check is deliberately broken to look at exit codes, whereas existing tests missed two of three breakages. They list what remains untested, including stopping during tool execution, Linux and other versions, and leftover child processes, and recommend re-running their script after a version upgrade.

FAQ
What exit code does a SIGINT-stopped claude -p return?
In Claude Code 2.1.319 it returned 0, the same value as a successful run, in all five SIGINT trials; SIGTERM returned 143.
Why did the author's own tests miss this?
The test double for claude returned 130 on SIGINT, so the tests passed while the real binary returned 0, and existing tests missed two of three deliberate breakages.
What should replace exit-code checks for completion?
The author records on the stopping side that it stopped the run, and counts a run as finished only when a success result event appears.
Send on LINE

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

By signing up you agree to the Terms of Service and Privacy Policy.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleFirefox Smart Window picks Mistral Small 4 as recommended model