Piping a script through tail hides its failing exit code from AI coding agents
A solo iOS developer in Japan found that Claude Code reported his check script as passing when it had actually failed. The agent ran the script piped into tail, so it saw tail's exit code of 0 rather than the script's exit code of 1. Two known failures were involved the first time, and a new failure in a request-validation check appeared during an unattended session the second time. The article explains that a pipeline's exit status comes from its last command, and shows how to recover the first command's status in bash or zsh using PIPESTATUS or pipestatus. It also covers set -o pipefail, which works in both shells, and notes that GitHub Actions' default bash shell behaves differently from an explicitly set one.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)
Log in to join the discussion and vote.
Log in