Skip to content
Myr

Make sure sourcing `nvm.sh` on shells that don't support source options doesn't exit nonzero.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixes #721

authored by Jordan Harband · committed by Jordan Harband · parent 96c96ec · Browse files · 2 files+12 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−1 removed

  • tests:+11 added−0 removed
  • other:+1 added−1 removed

2 files+12 added−1 removed

added:test/sourcing/Sourcing nvm.sh with no default should return 0+11 added
1#!/bin/sh23die () { echo $@ ; exit 1; }45touch ../../alias/default6rm ../../alias/default || die 'removal of default alias failed'7nvm_alias default && die '"nvm_alias default" did not fail'89set -e # necessary to fail internally with a nonzero code1011. ../../nvm.sh || die 'sourcing returned nonzero exit code'
modified:nvm.sh+1 added-1 removed
1782 unmodified lines
1783nvm_supports_source_options() {1784 [ "_$(echo 'echo $1' | . /dev/stdin yes 2> /dev/null)" = "_yes" ]1785}17861787VERSION="$(nvm_alias default 2>/dev/null)"1787VERSION="$(nvm_alias default 2>/dev/null || echo)"1788if nvm_supports_source_options && [ "_$1" = "_--install" ]; then1789 if [ -n "$VERSION" ]; then1790 nvm install "$VERSION" >/dev/null1791 elif nvm_rc_version >/dev/null 2>&1; then
9 unmodified lines