Fix agent-install first-run exit under set -e

This commit is contained in:
Haitao Pan 2026-02-09 16:21:24 +08:00
parent 901562129d
commit ba0e00a358

View File

@ -169,7 +169,10 @@ version_from_bin() {
local bin="$1"
local regex="$2"
if [[ ! -x "${bin}" ]]; then
return 1
# With `set -e`, a non-zero exit inside command substitution would abort the script.
# Missing binaries are expected on first install, so return empty + success.
echo ""
return 0
fi
"${bin}" --version 2>/dev/null | grep -Eo "${regex}" | head -n1 || true
}