From 95a17373310b5ab2ba74ee933fd217eee706d477 Mon Sep 17 00:00:00 2001 From: Matthias Kurz Date: Mon, 29 Apr 2024 10:47:06 +0200 Subject: [PATCH] Make test script fail when any command fails --- test.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test.sh b/test.sh index e885e0e9d..5bd2a8b2a 100755 --- a/test.sh +++ b/test.sh @@ -1,4 +1,11 @@ #!/usr/bin/env bash + +# -e Exit script immediately if any command returns a non-zero exit status. +# -u Exit script immediately if an undefined variable is used. +# -o pipefail Ensure Bash pipelines return a non-zero status if any of the commands fail, +# rather than returning the exit status of the last command in the pipeline. +set -euo pipefail + if [ -z "$MATRIX_SCALA" ]; then echo "Error: the environment variable MATRIX_SCALA is not set" exit 1