Skip to content

Commit

Permalink
Fixes error swallowing when using .nvmrc (#42)
Browse files Browse the repository at this point in the history
When a .nvmrc exists in the folder with a version that it's not
installed. fish-nvm swallows the error and says that command
(node,npm,npx,etc) is not installed.
  • Loading branch information
FabioAntunes authored Nov 9, 2019
1 parent a764ac3 commit 6a6d661
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions functions/__nvm_run.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ function __nvm_run
function run_command
set stack (status stack-trace | grep called | cut -d " " -f 7)
set count (count $argv)
if test "$count" -ge 2
set args $argv[2..-1]
else
set args ""
end

if type -fqP $argv[1]; and test "$stack[1]" != (which $argv[1])
set count (count $argv)
Expand Down Expand Up @@ -48,12 +43,15 @@ function __nvm_run
end

if not test -n "$NVM_HAS_RUN"
if test -f .nvmrc; and nvm use > /dev/null 2>&1
if can_run_command $argv[1]
if test -f .nvmrc;
set nvm_output (nvm use)
set nvm_status $status
if test $nvm_status -gt 0
echo $nvm_output
end
if test $nvm_status -eq 0; and can_run_command $argv[1]
set -gx NVM_HAS_RUN 1
run_command $argv
else
run_default $argv
end
else
run_default $argv
Expand Down

0 comments on commit 6a6d661

Please sign in to comment.