Lydia Hallie ✨· @lydiahallie · X·· 2 小时前AI 评分58
AI 导读
Lydia Hallie 说明 Claude Code 中 exit 1 也可能表示 hook 本身出错(如缺依赖或脚本 bug)。想让 Claude 重试应退出码用 2,并把输出写到 stderr,例如 "[your command] >&2 || { echo failed; exit 2; }"。
正文 · 原文
exit 1 can also mean that the hook itself errored (eg a missing dependency or a bug in the hook script)
so exit with 2 when you want Claude to retry, and send the output to stderr so it can see what went wrong. something like "[your command] >&2 || { echo failed; exit 2; }"
来源:Lydia Hallie ✨ · x.com