fix(cli): make Ctrl-C escape shell loops and abort cleanly

main

Commit

toothbrush2mo ago

An interactive shell only aborts a while true; do entire ...; done loop when the child is killed by SIGINT (WIFSIGNALED). entire trapped SIGINT and exited normally, so every Ctrl-C just ended one iteration and the loop instantly respawned entire — the user could never break out.

  • On abort, re-raise SIGINT to self (dieFromInterrupt) so the process dies by the signal and enclosing loops break on a single Ctrl-C.
  • Second Ctrl-C force-quits, so a genuinely stuck shutdown still has an escape hatch (the first signal now only cancels + warns).
  • Treat context.Canceled as a silent 130 exit instead of dumping the raw transport/keyring cancellation string as if it were a failure.

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

Checkpoints

Fix Ctrl-C Signal Handling in CLI

Claude CodeOpus 4.8[1m]
View session
Checkpoint 1