Fix `nvm ls v1.0.3` so that it locates `iojs-v1.0.3`.
Also fix `nvm uninstall v1.0.3` so it won't uninstall it if it's the current version. node versions will still take priority if there's ever a version overlap.master
parent
3d3d9d3a8d
commit
a6819b3018
6
nvm.sh
6
nvm.sh
|
@ -469,6 +469,8 @@ nvm_ls() {
|
|||
if [ "_$(echo "$PATTERN" | cut -c1-1)" = "_v" ] && [ "_$(nvm_num_version_groups "$PATTERN")" = "_3" ]; then
|
||||
if [ -d "$(nvm_version_path "$PATTERN")" ]; then
|
||||
VERSIONS="$PATTERN"
|
||||
elif [ -d "$(nvm_version_path "$(nvm_add_iojs_prefix "$PATTERN")")" ]; then
|
||||
VERSIONS="$(nvm_add_iojs_prefix "$PATTERN")"
|
||||
fi
|
||||
else
|
||||
case "$PATTERN" in
|
||||
|
@ -1081,8 +1083,8 @@ nvm() {
|
|||
VERSION="$(nvm_version "$PATTERN")"
|
||||
;;
|
||||
esac
|
||||
if [ "_$PATTERN" = "_$(nvm_ls_current)" ]; then
|
||||
if nvm_is_iojs_version "$PATTERN"; then
|
||||
if [ "_$VERSION" = "_$(nvm_ls_current)" ]; then
|
||||
if nvm_is_iojs_version "$VERSION"; then
|
||||
echo "nvm: Cannot uninstall currently-active io.js version, $VERSION (inferred from $PATTERN)." >&2
|
||||
else
|
||||
echo "nvm: Cannot uninstall currently-active node version, $VERSION (inferred from $PATTERN)." >&2
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
|
||||
die () { echo $@ ; exit 1; }
|
||||
|
||||
. ../../../nvm.sh
|
||||
|
||||
nvm deactivate 2>&1 >/dev/null || die 'deactivate failed'
|
||||
|
||||
nvm use 'v1.0.0' || die 'nvm use v1.0.0 failed'
|
||||
OUTPUT="$(nvm current)"
|
||||
EXPECTED_OUTPUT="$(nvm_version v1.0.0)"
|
||||
|
||||
[ "_$OUTPUT" = "_$EXPECTED_OUTPUT" ] \
|
||||
|| die "'nvm use v1.0.0' + 'nvm current' did not output '$EXPECTED_OUTPUT'; got '$OUTPUT'"
|
Loading…
Reference in New Issue