diff --git a/tools/r1_patcher/r1_patcher.sh b/tools/r1_patcher/r1_patcher.sh index 7d1653310e..7cc102044b 100755 --- a/tools/r1_patcher/r1_patcher.sh +++ b/tools/r1_patcher/r1_patcher.sh @@ -8,6 +8,12 @@ if [[ $# -ne 2 ]]; then exit 1 fi +# Fail fast on any error, undefined variable, or failed pipeline +set -euo pipefail + +# Report errors with line number and the failing command +trap 'echo "ERROR at line ${LINENO}: ${BASH_COMMAND}" >&2' ERR + ################################################################################ ### init ################################################################################