Fix follow-up bug from the bindgen_env unbound-variable patch

The \${arr[@]:-} default-value form avoids bash 3.2's unbound-variable
error on an empty array, but on macOS's stock bash it still expands to
a single empty-string word, so `env "" cargo build ...` tried to exec
an empty command name and failed with exit 127. Build the cargo
invocation as an array and only wrap it with `env` when bindgen_env
actually has entries, avoiding any [@] expansion of an empty array.
This commit is contained in:
KhooLy 2026-07-20 16:18:20 +03:00
parent 782b977e08
commit c0da06c05d

View file

@ -59,10 +59,13 @@ build_rust_core() {
fi
fi
if [[ "$profile" == "Release" ]]; then
env "${bindgen_env[@]:-}" cargo build --no-default-features --features ios "$@" --release
local cargo_cmd=(cargo build --no-default-features --features ios "$@")
[[ "$profile" == "Release" ]] && cargo_cmd+=(--release)
if [[ ${#bindgen_env[@]} -gt 0 ]]; then
env "${bindgen_env[@]}" "${cargo_cmd[@]}"
else
env "${bindgen_env[@]:-}" cargo build --no-default-features --features ios "$@"
"${cargo_cmd[@]}"
fi
}