-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Unset NVM_BIN when is not necessary #1033
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -1913,11 +1914,13 @@ nvm() { | |||
if [ $NVM_USE_SILENT -ne 1 ]; then | |||
echo "Now using system version of node: $(node -v 2>/dev/null)$(nvm_print_npm_version)" | |||
fi | |||
unset NVM_BIN NVM_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line shouldn't be needed, since you're doing it in nvm deactivate
already
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in 0227822
@robsonpeixoto it's much simpler than that. |
@@ -1870,6 +1870,7 @@ nvm() { | |||
echo "$NVM_DIR/*/lib/node_modules removed from \$NODE_PATH" | |||
fi | |||
fi | |||
unset NVM_BIN NVM_PATH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this have -f
so that it will try to unset it even if it happens not to be set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-f
is useful to remove function definition.
And I do not see any problem if it unset a variable that no dot exists.
~> export OI=123
~> echo $?
0
~> unset OI
~> echo $?
0
~> unset OI
~> echo $?
0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
k thanks, just confirming :-)
Assuming tests pass, I think this looks great! Would you mind rebasing it down to a single commit? |
I can, @ljharb. Before or after the tests finish ? |
Either way, but I suppose we might as well wait til they pass to make sure there's no further tweaks needed. Thanks! |
Done @ljharb. |
@robsonpeixoto awesome! if you'd mind one more rebase that'd be awesome, otherwise i'll merge this in later today :-D |
A rebase with the master done, @ljharb |
Thanks! |
v0.31.1 Changelog New Stuff: - `nvm uninstall`: Check installation dir permissions before uninstalling; display "fix" commands (nvm-sh#847) - `nvm alias`: colorize output to match `nvm ls` - `nvm alias`: colorize output when creating aliases - `nvm ls`/`nvm alias`/`nvm ls-remote`: only colorize when colors are supported Fixes: - don’t use bash `==` in conditionals - `nvm run`: pass through `--silent` on bare `nvm run` - `nvm exec`: show “io.js” for io.js versions - `set -e`: ensure `nvm_version` returning 3, and `nvm_alias` returning 2, doesn’t terminate the process - `nvm alias`: explicitly forbid user aliases in subdirs - `read` exits 1 when `.nvmrc` lacks a trailing newline; avoid that - `set -x`: avoid an unbound variable - `deactivate`: unset `$NVM_BIN` and `$NVM_PATH` (nvm-sh#1033) Performance: - `nvm alias`: slightly speed up alias resolution - Use `awk` to improve version comparison performance Robustness: - add a missing `command` to a `sed` call Misc: - Various README tweaks - Various testing improvements - Prefer `nvm --help` over `nvm help`
I would like to know if my current shell are using a node configured by the nvm.
But the are only 3 cheap ways to know
Using the NVM_BIN is very simple. Using this simple function:
But after a
nvm deactivate
ornvm use system
the nvm keep these environment variables.