fix(cli): gate silent-abort on signal handler firing; test exit codes

main

Commit

toothbrush2mo ago

Addresses two trail findings:

  • Matching context.Canceled at the top level was too broad: an internally-cancelled sub-context would have silently re-raised SIGINT (exit 130) and broken an enclosing loop even without a Ctrl-C. Gate the abort path on caughtSignal being set, so a signal-less context.Canceled falls through to normal error reporting.
  • Add a table test for exitCodeForSignal locking SIGINT→130, SIGTERM→143 (and the non-numeric fallback), guarding the mapping the fix relies on.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com Entire-Checkpoint: e087cbfd44e3

Checkpoints

Fix Ctrl-C Signal Handling in CLI

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1