Skip to content

Commit dddd7a2

Browse files
authored
fix: fallback to /usr/bin/env if env is not in PATH (#3577)
This fixes an issue where the bootstrap script would fail if env was not in the PATH, which is the case on NixOS, or when Bazel's strict action env is enabled. To fix, the bootstrap checks if env exists, and if not, falls back to /usr/bin/env. Fixes #3575
1 parent afe7981 commit dddd7a2

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

python/private/stage1_bootstrap_template.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,14 @@ fi
285285

286286
export RUNFILES_DIR
287287

288+
if command -v env >/dev/null 2>&1; then
289+
ENV_CMD="env"
290+
else
291+
ENV_CMD="/usr/bin/env"
292+
fi
293+
288294
command=(
289-
env
295+
"$ENV_CMD"
290296
"${interpreter_env[@]}"
291297
"$python_exe"
292298
"${interpreter_args[@]}"

0 commit comments

Comments
 (0)