From f4026cbc45f28ff386092916997ebc7e81efdc3c Mon Sep 17 00:00:00 2001 From: Malin von Matern Date: Thu, 7 Jul 2022 12:00:42 +0200 Subject: [PATCH 1/2] Use correct asdf paths for shims --- shell/env.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/shell/env.sh b/shell/env.sh index 7be3e89..5b44017 100755 --- a/shell/env.sh +++ b/shell/env.sh @@ -71,6 +71,10 @@ get_vanilla_product_path() ( if [[ -z "\$NODE_SAFE_VANILLA_NODE_PATH" ]]; then # nvm can change the path of the node binary om the fly, hence it takes precedence if set [[ -n "\$NVM_BIN" ]] && NODE_SAFE_VANILLA_NODE_PATH="\$NVM_BIN/node" + if [[ -n "\$ASDF_DIR" ]]; then + [[ -n "\$NODE_SAFE_DEBUG_SANDBOX" ]] && echo "node-safe (shell): getting node path from asdf" + NODE_SAFE_VANILLA_NODE_PATH="\$(asdf which node)" + fi fi if [[ -z "\$NODE_SAFE_VANILLA_NODE_PATH" ]]; then # get the vanilla node from the other PATH entries, ignoring our own directory @@ -137,7 +141,12 @@ do done # Store reference to the original node binary for faster lookups later -export NODE_SAFE_VANILLA_NODE_PATH=$(which node) +if [[ -n "$ASDF_DIR" ]]; then + NODE_SAFE_VANILLA_NODE_PATH=$(asdf which node) +else + NODE_SAFE_VANILLA_NODE_PATH=$(which node) +fi +export NODE_SAFE_VANILLA_NODE_PATH [[ -z "$NODE_SAFE_DIR" ]] && export NODE_SAFE_DIR="$CURRENT_DIR" # Prepend the path with our bin directory so we get called when e.g. node is executed From 806094523db81f96299fde05dc0e8141a4b9ac3c Mon Sep 17 00:00:00 2001 From: Malin von Matern Date: Thu, 7 Jul 2022 12:07:10 +0200 Subject: [PATCH 2/2] Also chek if asdf exists --- shell/env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/env.sh b/shell/env.sh index 5b44017..17298ff 100755 --- a/shell/env.sh +++ b/shell/env.sh @@ -71,7 +71,7 @@ get_vanilla_product_path() ( if [[ -z "\$NODE_SAFE_VANILLA_NODE_PATH" ]]; then # nvm can change the path of the node binary om the fly, hence it takes precedence if set [[ -n "\$NVM_BIN" ]] && NODE_SAFE_VANILLA_NODE_PATH="\$NVM_BIN/node" - if [[ -n "\$ASDF_DIR" ]]; then + if command -v asdf > /dev/null && [[ -n "\$ASDF_DIR" ]]; then [[ -n "\$NODE_SAFE_DEBUG_SANDBOX" ]] && echo "node-safe (shell): getting node path from asdf" NODE_SAFE_VANILLA_NODE_PATH="\$(asdf which node)" fi @@ -141,7 +141,7 @@ do done # Store reference to the original node binary for faster lookups later -if [[ -n "$ASDF_DIR" ]]; then +if command -v asdf > /dev/null && [[ -n "$ASDF_DIR" ]]; then NODE_SAFE_VANILLA_NODE_PATH=$(asdf which node) else NODE_SAFE_VANILLA_NODE_PATH=$(which node)