Skip to content

Commit

Permalink
Switch to command -v over which
Browse files Browse the repository at this point in the history
This fixes an issue on macOS where `which` failed to return any results
because the `PATH` wasn't propagated. `command` is more standard for
this use case as well https://github.com/koalaman/shellcheck/wiki/SC2230

Fixes bazelbuild#8414
  • Loading branch information
keith committed May 21, 2019
1 parent 3d8925d commit f74875a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/python/pywrapper_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ die() {
}

# Try the "python%VERSION%" command name first, then fall back on "python".
PYTHON_BIN=`which python%VERSION% || echo ""`
PYTHON_BIN=`command -v python%VERSION% || echo ""`
USED_FALLBACK=0
if [ -z "${PYTHON_BIN:-}" ]; then
PYTHON_BIN=`which python || echo ""`
PYTHON_BIN=`command -v python || echo ""`
USED_FALLBACK=1
fi
if [ -z "${PYTHON_BIN:-}" ]; then
Expand Down

0 comments on commit f74875a

Please sign in to comment.