fix(release): set -e abort on command-substitution exit code

The per-platform binary-suffix check used
f="$OUT/${b}$( [ platform = windows-latest ] && echo .exe )".
The [ ] test exits 1 when false (linux/macos), and under 'set -euo
pipefail' the failing command substitution aborts the whole step before
any check output — exit 1 right after checksums with no error message.
Replace with an if/else BIN_EXT variable set before the loops.
Verified locally: full script block (checksums -> file check -> sanity)
passes with real pg_dump/pg_restore/psql + libpq, exit 0.
This commit is contained in:
2026-08-05 21:31:04 +08:00
parent 0d6c9a039a
commit 0b8b11cef3
+10 -2
View File
@@ -124,14 +124,22 @@ jobs:
;;
esac
(cd "$OUT" && sha256sum * | tee checksums.txt)
# Resolve the per-platform binary suffix WITHOUT a command
# substitution: `$( [ ... ] && echo .exe )` returns exit 1 when the
# test is false, and under `set -e` that aborts the whole step.
if [ "${{ matrix.platform }}" = windows-latest ]; then
BIN_EXT=".exe"
else
BIN_EXT=""
fi
for b in pg_dump pg_restore psql; do
f="$OUT/${b}$( [ "${{ matrix.platform }}" = windows-latest ] && echo .exe )"
f="$OUT/${b}${BIN_EXT}"
test -f "$f" || { echo "missing $f"; exit 1; }
done
# Sanity: every tool must run (loader path is correct) — this catches
# a wrong @loader_path / rpath before we ship a broken bundle.
for b in pg_dump pg_restore psql; do
"$OUT/${b}$( [ "${{ matrix.platform }}" = windows-latest ] && echo .exe )" --version >/dev/null 2>&1 || { echo "$b failed to run from resource dir"; exit 1; }
"$OUT/${b}${BIN_EXT}" --version >/dev/null 2>&1 || { echo "$b failed to run from resource dir"; exit 1; }
done
- name: Build and upload to GitHub Release