From 0b8b11cef30ad2a2c98bf5ecc0714ff64c1e063d Mon Sep 17 00:00:00 2001 From: Adrian Bonpin Date: Wed, 5 Aug 2026 21:31:04 +0800 Subject: [PATCH] fix(release): set -e abort on command-substitution exit code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/workflows/release.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 944a372..1e489ec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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