Skip to content

Commit

Permalink
fix: emit output when bailing out
Browse files Browse the repository at this point in the history
Turns out that shellcheck was right, and my bash-fu was weak. This
now properly emits output to stderr instead of a file named `2`.

Also it now uses `printf` instead of `echo` so that things like `\n` work.
  • Loading branch information
coriolinus committed Jan 21, 2025
1 parent 9fd4c5a commit f85004b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions scripts/merge-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ set -e -o pipefail
function bail() {
msg="$1"
if [ -n "$msg" ]; then
# we do want to emit to stderr here
#shellcheck disable=SC2210
echo >2 "$msg"
>&2 printf "%s\n" "$msg"
fi
exit 1
}
Expand Down

0 comments on commit f85004b

Please sign in to comment.