#!/bin/bash # The full gate, ending in a line that survives a pipe: "=== CHECK EXIT n ===". # `npm run check | tail -20` reports tail's exit code, not npm's, so a red run reads as green – # and `set -o pipefail` in here does not help, it only covers pipes inside this script (measured). # Reading the closing line does. set -o pipefail npm run check code=$? echo "=== CHECK EXIT $code ===" exit $code