Skip to content

Commit 21c97fb

Browse files
FiveTechSoftclaude
andcommitted
fix(mac build): detect_brew_prefix must not abort under set -e
The helper used to return the exit status of its last conditional, so when neither brew nor the fallback prefix dirs were present it bubbled up exit code 1. With \`set -e\` at the top of build_mac.sh that aborted the build right after step [3c/4], before the new optional-mysql / optional-libpq logic ran. Force an explicit \`return 0\` on every path. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8137118 commit 21c97fb

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

build_mac.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,23 @@ fi
234234
# install Homebrew package regardless of arch (/opt/homebrew on arm64,
235235
# /usr/local on x86_64).
236236
detect_brew_prefix() {
237-
# $1 = formula name; echoes prefix or empty
237+
# $1 = formula name; echoes prefix or empty. Always returns 0 (so callers
238+
# using `set -e` don't abort when no install is found).
238239
local pkg="$1" pfx=""
239240
if command -v brew >/dev/null 2>&1; then
240241
pfx=$(brew --prefix "$pkg" 2>/dev/null || true)
241-
[ -n "$pfx" ] && [ -d "$pfx" ] && { echo "$pfx"; return; }
242+
if [ -n "$pfx" ] && [ -d "$pfx" ]; then
243+
echo "$pfx"
244+
return 0
245+
fi
242246
fi
243247
for cand in "/opt/homebrew/opt/$pkg" "/usr/local/opt/$pkg"; do
244-
[ -d "$cand" ] && { echo "$cand"; return; }
248+
if [ -d "$cand" ]; then
249+
echo "$cand"
250+
return 0
251+
fi
245252
done
253+
return 0
246254
}
247255

248256
MYSQL_PREFIX=$(detect_brew_prefix mysql-client)

0 commit comments

Comments
 (0)