跳到正文
数字商店
原文
Lydia Hallie ✨· @lydiahallie · X·· 18 天前AI 评分50
AI 导读

exit 1 也可能意味着 hook 本身出错了(比如缺少依赖,或 hook 脚本里有 bug) 所以当你想让 Claude 重试时,用 exit 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