Skip to content

Commit 7fbd555

Browse files
authored
Use "command -v" instead of "which" to detect python executable (#1419)
On a Linux distro that doesn't have the `which` program installed we're getting the following error: $ ./emsdk install latest ./emsdk: line 39: exec: python: not found It's failing to detect the installed `python3` and falls back to using `python`, but this distro doesn't provide a python -> python3 symlink so we fail. Fix this by using `command -v` instead which is a POSIX standard. The same change went into emscripten a couple years ago: emscripten-core/emscripten#15071
1 parent a33daf3 commit 7fbd555

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

emsdk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626
# If bundled python is not found, look for `python3` in PATH. This is especially important on macOS (See:
2727
# https://github.com/emscripten-core/emsdk/pull/273)
2828
if [ -z "$EMSDK_PYTHON" ]; then
29-
if PYTHON3="$(which python3 2>/dev/null)"; then
29+
if PYTHON3="$(command -v python3 2>/dev/null)"; then
3030
EMSDK_PYTHON=$PYTHON3
3131
fi
3232
fi

0 commit comments

Comments
 (0)