From e5c212b56fb7c4f91d369faa3981488e09002cf1 Mon Sep 17 00:00:00 2001 From: Yacin Tmimi Date: Mon, 10 Jul 2023 10:03:51 -0400 Subject: [PATCH] Improve error discovery in `check_diff.sh` The `set -e` option is used to immediately exit if any command exits with a non zero exit status. This will help us catch errors in the script, for example, needing the `LD_LIBRARY_PATH` to be set. --- ci/check_diff.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ci/check_diff.sh b/ci/check_diff.sh index 6f30e8ba9cb4..a685c2e108e6 100755 --- a/ci/check_diff.sh +++ b/ci/check_diff.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + # https://github.com/rust-lang/rustfmt/issues/5675 export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH @@ -143,9 +145,15 @@ function check_repo() { init_submodules $SUBMODULES fi + + # rustfmt --check returns 1 if a diff was found + # Also check_diff returns 1 if there was a diff between master rustfmt and the feature branch + # so we want to ignore the exit status check + set +e check_diff $REPO_NAME # append the status of running `check_diff` to the STATUSES array STATUSES+=($?) + set -e echo "removing tmp_dir $tmp_dir" rm -rf $tmp_dir