silent which nvm error in lazy load

GNU `which` prints an error to stderr when a binary is not found, that
is displayed with every new terminal startup when zsh-nvm is in lazy
load mode:

`/usr/local/bin/gwhich: no nvm in (...)`

This patch redirects `which` errors to `/dev/null` while keeping stdout output
available.
This commit is contained in:
Aitor Guevara 2017-09-15 12:13:25 +02:00 committed by GitHub
parent 9dbb51b388
commit 094a9a6e28

View File

@ -92,7 +92,7 @@ _zsh_nvm_lazy_load() {
local cmds local cmds
cmds=() cmds=()
for bin in $global_binaries; do for bin in $global_binaries; do
[[ "$(which $bin)" = "$bin: aliased to "* ]] || cmds+=($bin) [[ "$(which $bin 2> /dev/null)" = "$bin: aliased to "* ]] || cmds+=($bin)
done done
# Create function for each command # Create function for each command