Propagate a delegated plugin's exit code and signal from agent-help

main

Commit

Soph1w ago

agent-help runs the plugin inside a Cobra command, and main.go turns any returned error into a plain exit 1. So a plugin exiting 42 made agent-help exit 1, and a plugin killed by a signal that reached only it (kill -TERM at the plugin, SIGPIPE) lost that signal: exit 1 instead of 143/141, and not WIFSIGNALED, so an enclosing shell loop kept going.

The command now returns cli.PluginExitError carrying runPlugin's code and killedBy. main.go exits with it through exitWithPluginOutcome, the dispatcher's existing handling moved into a function both paths share, so the precedence rules (our own signal outranks the child's) are one copy. The error reports AlreadyPrinted: the plugin's stderr is the message.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com Entire-Checkpoint: 01M3MYC0SWGZANGGCV95ZDQH74

Checkpoints

Add Hidden Checkpoint Create Command

Claude CodeOpus 5.5
View session
Checkpoint 1