Skip to content

Commit

Permalink
ci(shellcheck): fix exit code propagation (reanahub#425)
Browse files Browse the repository at this point in the history
Return properly the exit code status of shellcheck command when looping
through shell script files.
  • Loading branch information
tiborsimko committed Feb 8, 2024
1 parent 866675b commit 8e74a85
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions etc/job_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
# around by dumping command to a
# temporary wrapper file.
tmpjob=$(mktemp -p .)
chmod +x $tmpjob
chmod +x "$tmpjob"
echo "command to execute:"
# $@ input is base64 encoded string of command to execute
# shellcheck disable=SC2068,SC2294
eval $@

echo "$@" "|bash" > $tmpjob
bash $tmpjob
echo "$@" "|bash" > "$tmpjob"
bash "$tmpjob"
res=$?
rm $tmpjob
rm "$tmpjob"

if [ $res != 0 ]; then
echo "[Error] Execution failed with error code: $res"
Expand Down
2 changes: 1 addition & 1 deletion run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ check_commitlint () {
}

check_shellcheck () {
find . -name "*.sh" -exec shellcheck {} \;
find . -name "*.sh" -exec shellcheck {} \+
}

check_pydocstyle () {
Expand Down

0 comments on commit 8e74a85

Please sign in to comment.