Skip to content

Commit 8fb4ee0

Browse files
committed
Unset unnecessary environment variables
1 parent d8a3b07 commit 8fb4ee0

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

nvm.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1870,6 +1870,7 @@ nvm() {
18701870
echo "$NVM_DIR/*/lib/node_modules removed from \$NODE_PATH"
18711871
fi
18721872
fi
1873+
unset NVM_BIN NVM_PATH
18731874
;;
18741875
"use" )
18751876
local PROVIDED_VERSION

test/fast/Running "nvm deactivate" should unset the nvm environment variables.

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ die () { echo $@ ; exit 1; }
1010
nvm use --delete-prefix v0.2.3 || die "Failed to activate v0.2.3"
1111
[ `expr "$PATH" : ".*v0.2.3/.*/bin"` != 0 ] || die "PATH not set up properly"
1212
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "NODE_PATH should not contain (npm root -g)"
13+
[ `expr "$NVM_BIN" : ".*v0.2.3/bin"` != 0 ] || die "NODE_BIN should contain bin directory path"
14+
[ `expr "$NVM_PATH" : ".*v0.2.3/lib/node"` != 0 ] || die "NODE_PATH should contain lib node directory path"
1315
# ^ note: NODE_PATH should not contain `npm root -g` since globals should not be requireable
1416

1517
nvm deactivate || die "Failed to deactivate v0.2.3"
1618
[ `expr "$PATH" : ".*v0.2.3/.*/bin"` = 0 ] || die "PATH not cleaned properly"
1719
[ `expr "$NODE_PATH" : ".*v0.2.3/.*/lib/node_modules"` = 0 ] || die "NODE_PATH not cleaned properly"
20+
[ "_$NVM_BIN" = "_" ] || die "NVM_BIN should be unset: got '$NVM_BIN'"
21+
[ "_$NVM_PATH" = "_" ] || die "NVM_PATH should be unset: got '$NVM_PATH'"

0 commit comments

Comments
 (0)