Skip to content

Commit 24c60e4

Browse files
committed
Fix a bug in nvm_remote_version that was breaking nvm install stable/nvm install unstable.
Fixes #630.
1 parent 8822bd7 commit 24c60e4

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

nvm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ nvm_remote_version() {
218218
PATTERN="$1"
219219
local VERSION
220220
if nvm_validate_implicit_alias "$PATTERN" 2> /dev/null ; then
221-
VERSIONS="$(nvm_ls_remote "$PATTERN")"
221+
VERSION="$(nvm_ls_remote "$PATTERN")"
222222
else
223223
case "_$PATTERN" in
224224
"_$(nvm_node_prefix)")

test/fast/Unit tests/nvm_remote_version

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,36 @@ EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
2626

2727

2828
nvm_ls_remote() {
29-
echo "test output"
30-
echo "more test output"
31-
echo "pattern received: _$1_"
29+
if ! nvm_is_iojs_version "$1"; then
30+
echo "test output"
31+
echo "more test output"
32+
echo "pattern received: _$1_"
33+
fi
34+
}
35+
nvm_ls_remote_iojs() {
36+
if nvm_is_iojs_version "$1"; then
37+
echo "test iojs output"
38+
echo "more iojs test output"
39+
echo "iojs pattern received: _$1_"
40+
fi
3241
}
3342
OUTPUT="$(nvm_remote_version foo)"
3443
EXIT_CODE="$(nvm_remote_version foo >/dev/null 2>&1 ; echo $?)"
3544
[ "_$OUTPUT" = "_pattern received: _foo_" ] \
3645
|| die "nvm_remote_version foo did not return last line only of nvm_ls_remote foo; got $OUTPUT"
3746
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version foo did not exit with 0, got $EXIT_CODE"
3847

39-
nvm_ls_remote_iojs() {
40-
echo "test iojs output"
41-
echo "more iojs test output"
42-
echo "iojs pattern received: _$1_"
43-
44-
}
4548
OUTPUT="$(nvm_remote_version iojs-foo)"
4649
EXIT_CODE="$(nvm_remote_version iojs-foo >/dev/null 2>&1 ; echo $?)"
4750
[ "_$OUTPUT" = "_iojs pattern received: _iojs-foo_" ] \
4851
|| die "nvm_remote_version iojs-foo did not return last line only of nvm_ls_remote_iojs foo; got $OUTPUT"
4952
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version iojs-foo did not exit with 0, got $EXIT_CODE"
5053

54+
OUTPUT="$(nvm_remote_version stable)"
55+
EXIT_CODE="$(nvm_remote_version stable >/dev/null 2>&1 ; echo $?)"
56+
[ "_$OUTPUT" = "_$(nvm_ls_remote stable)" ] \
57+
|| die "nvm_remote_version stable did not return contents of nvm_ls_remote stable; got $OUTPUT"
58+
[ "_$EXIT_CODE" = "_0" ] || die "nvm_remote_version stable did not exit with 0, got $EXIT_CODE"
59+
5160
cleanup
5261

0 commit comments

Comments
 (0)