When no arguments are passed to `nvm run X`, use `nvm exec` to open a REPL.

Fixes #625. Tests will be in #717.
master
Jordan Harband 2015-04-05 14:09:28 -07:00
parent c966204cd6
commit d68f667464
2 changed files with 7 additions and 1 deletions

View File

@ -11,4 +11,3 @@ else
fi
exec $@

7
nvm.sh
View File

@ -1451,6 +1451,13 @@ nvm() {
if [ "_$VERSION" = "_N/A" ]; then
echo "$(nvm_ensure_version_prefix "$provided_version") is not installed yet" >&2
EXIT_CODE=1
elif [ -z "$ARGS" ]; then
if [ "$NVM_IOJS" = true ]; then
nvm exec "$VERSION" iojs
else
nvm exec "$VERSION" node
fi
EXIT_CODE="$?"
elif [ "$NVM_IOJS" = true ]; then
echo "Running io.js $(nvm_strip_iojs_prefix "$VERSION")"
OUTPUT="$(nvm use "$VERSION" >/dev/null && iojs $ARGS)"