mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-09-21 00:00:07 +08:00
[Fix] zsh: restore nomatch and markdirs rather than clobbering them
`unsetopt local_options nomatch` unsets both named options, so LOCAL_OPTIONS is off by the time the function returns and the `nomatch` change escapes into the caller's shell: one `nvm ls` or `nvm alias` leaves NO_MATCH off for the rest of the session, after which an unmatched glob is silently passed through as a literal. `setopt local_options nonomatch`, already used in `nvm_check_file_permissions`, restores on return. The `markdirs` line also cancelled the snapshot taken for `shwordsplit` on the line above it; that one is latent, as `nvm_ls` is only ever called inside a command substitution.
This commit is contained in:
@@ -1389,7 +1389,7 @@ nvm_list_aliases() {
|
||||
NVM_HAS_COLORS=1
|
||||
fi
|
||||
|
||||
nvm_is_zsh && unsetopt local_options nomatch
|
||||
nvm_is_zsh && setopt local_options nonomatch
|
||||
(
|
||||
local ALIAS_PATH
|
||||
for ALIAS_PATH in "${NVM_ALIAS_DIR}/${ALIAS}"*; do
|
||||
@@ -1685,7 +1685,7 @@ nvm_ls() {
|
||||
esac
|
||||
|
||||
nvm_is_zsh && setopt local_options shwordsplit
|
||||
nvm_is_zsh && unsetopt local_options markdirs
|
||||
nvm_is_zsh && setopt local_options nomarkdirs
|
||||
|
||||
local NVM_DIRS_TO_SEARCH1
|
||||
NVM_DIRS_TO_SEARCH1=''
|
||||
|
||||
Reference in New Issue
Block a user