REFERENCE · EXECUTION
Exit codes
Native CLI
0 means one or more matches, 1 means a normal no-match result, and 2 covers usage, I/O, resource, and compile errors.
A broken pipe is a normal consumer-closed output condition.
Structural context verification failures also produce a diagnostic on stderr and status 2.
npm CLI
0 means a match, 1 means no match, and 2 means an execution error. The native structural-verification diagnostic is not exposed. Invalid UTF-8 and binary files are reported and skipped; an explicit path read failure returns 2.
--help and --version succeed with 0.
Pipeline use
Under set -e, no-match status 1 can stop a script. Branch explicitly when it is allowed, without converting status 2 to success.
If partial stdout is followed by status 2, discard it or mark it incomplete.