From 52f67b36777ea738e6e16cf4d9be033868f0201e Mon Sep 17 00:00:00 2001 From: Vesa Vilhonen Date: Fri, 20 Nov 2020 13:06:28 +0200 Subject: [PATCH] [Fix] `exec`: `--` should stop argument parsing Co-authored-by: Vesa Vilhonen Co-authored-by: Sladyn Nunes --- nvm.sh | 1 + .../Running 'nvm exec' with help should not parse | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 test/slow/nvm exec/Running 'nvm exec' with help should not parse diff --git a/nvm.sh b/nvm.sh index d1947f3..b5232c6 100644 --- a/nvm.sh +++ b/nvm.sh @@ -2612,6 +2612,7 @@ nvm() { for i in "$@" do case $i in + --) break ;; '-h'|'help'|'--help') NVM_NO_COLORS="" for j in "$@"; do diff --git a/test/slow/nvm exec/Running 'nvm exec' with help should not parse b/test/slow/nvm exec/Running 'nvm exec' with help should not parse new file mode 100644 index 0000000..4e8b632 --- /dev/null +++ b/test/slow/nvm exec/Running 'nvm exec' with help should not parse @@ -0,0 +1,9 @@ +#!/bin/sh + +die () { echo "$@" ; exit 1; } + +\. ../../../nvm.sh + +nvm use 0.10 + +nvm exec stable -- node --help | grep 'Usage: node [options]' || die "Help menu should have been displayed for node and not nvm"