Skip to content

Commit

Permalink
Fix error propagation in format-cabal.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
wenkokke committed Nov 13, 2024
1 parent 318fadf commit 30afc5d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/format-cabal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ fi
# Check Cabal files with cabal-fmt
echo "Formatting Cabal source files with cabal-fmt version ${cabal_fmt_required_version}"
# shellcheck disable=SC2016
if ! git ls-files --exclude-standard --no-deleted --deduplicate '*.cabal' | xargs -L 1 sh -c 'echo "$0" && cabal-fmt -i "$0"'; then
if ! git ls-files --exclude-standard --no-deleted --deduplicate '*.cabal' | xargs -L 1 sh -c 'echo "$0" && cabal-fmt -c "$0" 2>/dev/null || (cabal-fmt -i "$0" && exit 1)'; then
exit 1
fi
6 changes: 3 additions & 3 deletions scripts/pre-commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ if [ ! "${unstaged_cabal_files}" = "" ]; then
fi

# Run various checks and formatters
./scripts/check-cabal.sh
./scripts/format-cabal.sh
./scripts/format-stylish.sh
./scripts/check-cabal.sh || exit 1
./scripts/format-cabal.sh || exit 1
./scripts/format-stylish.sh || exit 1

0 comments on commit 30afc5d

Please sign in to comment.