Skip to content
Myr

[Fix] `nvm install`: fix `nvm err` typo to `nvm_err` for `-s`/`-b` conflict

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

The error message for using `-s` and `-b` together was calling `nvm err` (invoking nvm with subcommand "err") instead of the `nvm_err` helper function, causing the error message to never be displayed and instead showing the help text with exit code 127. Bug introduced in https://github.com/nvm-sh/nvm/commit/4fdef427e4b1d563570ba5992bdbe7d7e23f025b / #2439

authored by Jordan Harband · committed by Jordan Harband · parent ef16203 · Browse files · 2 files+20 added−2 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+20 added−2 removed

  • tests:+18 added−0 removed
  • other:+2 added−2 removed

2 files+20 added−2 removed

added:test/fast/Unit tests/nvm install -s and -b conflict+18 added
1#!/bin/sh23die () { echo "$@" ; exit 1; }45: nvm.sh6\. ../../../nvm.sh78\. ../../common.sh910EXPECTED_ERR='-s and -b cannot be set together since they would skip install from both binary and source'1112try_err nvm install -s -b 0.10.013[ "${CAPTURED_EXIT_CODE}" = "6" ] || die "Expected exit code 6 for -s -b, got ${CAPTURED_EXIT_CODE}"14[ "${CAPTURED_STDERR}" = "${EXPECTED_ERR}" ] || die "Expected >${EXPECTED_ERR}<, got >${CAPTURED_STDERR}<"1516try_err nvm install -b -s 0.10.017[ "${CAPTURED_EXIT_CODE}" = "6" ] || die "Expected exit code 6 for -b -s, got ${CAPTURED_EXIT_CODE}"18[ "${CAPTURED_STDERR}" = "${EXPECTED_ERR}" ] || die "Expected >${EXPECTED_ERR}<, got >${CAPTURED_STDERR}<"
modified:nvm.sh+2 added-2 removed
3437 unmodified lines
3438 -s)3439 shift # consume "-s"3440 nobinary=13441 if [ $nosource -eq 1 ]; then3442 nvm err '-s and -b cannot be set together since they would skip install from both binary and source'3442 nvm_err '-s and -b cannot be set together since they would skip install from both binary and source'3443 return 63444 fi3445 ;;3446 -b)3447 shift # consume "-b"3448 nosource=13449 if [ $nobinary -eq 1 ]; then3450 nvm err '-s and -b cannot be set together since they would skip install from both binary and source'3450 nvm_err '-s and -b cannot be set together since they would skip install from both binary and source'3451 return 63452 fi3453 ;;3454 -j)
1360 unmodified lines