From 7fbd555dbec53f863f74e5f119812351f02a7a2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Mon, 1 Jul 2024 18:22:28 +0200 Subject: [PATCH] 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: https://github.com/emscripten-core/emscripten/pull/15071 --- emsdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emsdk b/emsdk index 88144c3..55d46b9 100755 --- a/emsdk +++ b/emsdk @@ -26,7 +26,7 @@ fi # If bundled python is not found, look for `python3` in PATH. This is especially important on macOS (See: # https://github.com/emscripten-core/emsdk/pull/273) if [ -z "$EMSDK_PYTHON" ]; then - if PYTHON3="$(which python3 2>/dev/null)"; then + if PYTHON3="$(command -v python3 2>/dev/null)"; then EMSDK_PYTHON=$PYTHON3 fi fi