Build triage
- Fix the first error, not the last. Everything after the first error is
usually cascade.
cargo build 2>&1 | grep -m1 -B1 -A6 "^error". - Exit code 0 can still be a failure. The exit code of a pipeline belongs
to its last stage:
cargo build 2>&1 | tail -3reports tail's success. Trust the output text (error[,FAILED,panicked) over the code. - Bound the output.
| tail -20for verdicts (test runners put the verdict last),| head -30for first errors,--statfor diffs. Never dump a full build log. - Never escalate a timeout. A command that timed out will time out again
with a bigger budget. Kill leftovers (
pkill -f cargo), then narrow: one package, one test, one file.cargo check -p one-cratebeats a 10 minute workspace build. - Label pipeline stages so partial output says where it died:
echo "=== build ===" && cargo check 2>&1 | tail -3 && echo "=== test ===" && cargo test 2>&1 | tail -5 - Filter noise to signal. A hundred identical warnings hide one error:
2>&1 | grep -E "^(error|FAILED|thread)" | head -10.