Skip to content
This repository has been archived by the owner on Jul 6, 2019. It is now read-only.

Commit

Permalink
fix(auto-fallback): prevent infinite loop if npx disappears
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Jul 11, 2017
1 parent 7631bbe commit 6c24e58
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions auto-fallback.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ command_not_found_${opts.isBash ? 'handle' : 'handler'}() {
>&2 echo "${Y`command not found: ${'$1'}`}"
return 127
fi
echo "${Y`${'$1'} not found. Trying with npx...`}" >&2
if which npx > /dev/null; then
echo "${Y`${'$1'} not found. Trying with npx...`}" >&2
else
return 127
fi
if
which npx > /dev/null
if ! [[ $1 =~ @ ]]; then
npx --no-install "$@"
else
Expand All @@ -27,7 +33,11 @@ function __fish_command_not_found_on_interactive --on-event fish_prompt
functions --erase __fish_command_not_found_setup
function __fish_command_not_found_handler --on-event fish_command_not_found
echo "${Y`${'$argv[1]'} not found. Trying with npx...`}" >&2
if which npx > /dev/null
echo "${Y`${'$argv[1]'} not found. Trying with npx...`}" >&2
else
return 127
end
if string match -q -r @ $argv[1]
npx $argv
else
Expand Down

0 comments on commit 6c24e58

Please sign in to comment.