Skip to content

Commit e5c212b

Browse files
ytmimicalebcartwright
authored andcommitted
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.
1 parent 89500fa commit e5c212b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ci/check_diff.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
set -e
4+
35
# https://github.com/rust-lang/rustfmt/issues/5675
46
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH
57

@@ -143,9 +145,15 @@ function check_repo() {
143145
init_submodules $SUBMODULES
144146
fi
145147

148+
149+
# rustfmt --check returns 1 if a diff was found
150+
# Also check_diff returns 1 if there was a diff between master rustfmt and the feature branch
151+
# so we want to ignore the exit status check
152+
set +e
146153
check_diff $REPO_NAME
147154
# append the status of running `check_diff` to the STATUSES array
148155
STATUSES+=($?)
156+
set -e
149157

150158
echo "removing tmp_dir $tmp_dir"
151159
rm -rf $tmp_dir

0 commit comments

Comments
 (0)