Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions e2e/core/test_node_slow
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ mise settings set idiomatic_version_file_enable_tools node

mise i node@lts/hydrogen
mise i -f node
hydrogen_path="$(mise where node@lts/hydrogen)"
assert "mise x node@$corepack_version -- $hydrogen_path/bin/npm config get prefix" "$hydrogen_path"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The path $hydrogen_path should be quoted within the command string passed to assert. If the installation path contains spaces (which can occur depending on the user's environment or configuration), the command will fail to execute correctly because the shell will split the path into multiple arguments when the string is evaluated.

assert "mise x node@$corepack_version -- \"$hydrogen_path/bin/npm\" config get prefix" "$hydrogen_path"

assert_contains "mise x node@lts/hydrogen -- node --version" "v18."
assert "mise x -- node --version" "v$corepack_version"
assert_contains "mise x -- which yarn" "yarn"
Expand Down
5 changes: 3 additions & 2 deletions src/plugins/core/assets/node_npm_shim
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ should_reshim() {

wrap_npm_if_reshim_is_needed() {
local npm_cli="$plugin_dir/lib/node_modules/npm/bin/npm-cli.js"
local node_bin="$plugin_dir/bin/node"
if should_reshim "$@"; then
node "$npm_cli" "$@"
"$node_bin" "$npm_cli" "$@"
printf "Reshimming mise %s...\n" "$plugin_name" >&2
mise reshim
else
exec node "$npm_cli" "$@"
exec "$node_bin" "$npm_cli" "$@"
fi
}

Expand Down
Loading