Unset NVM_BIN when is not necessary#1033
Conversation
| 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.
this line shouldn't be needed, since you're doing it in nvm deactivate already
|
@robsonpeixoto it's much simpler than that. |
| echo "$NVM_DIR/*/lib/node_modules removed from \$NODE_PATH" | ||
| fi | ||
| fi | ||
| unset NVM_BIN NVM_PATH |
There was a problem hiding this comment.
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.
-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|
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 deactivateornvm use systemthe nvm keep these environment variables.