Skip to content

Commit 2453050

Browse files
committed
fix: post-clone hooks run without subshell
1 parent b6f6ef2 commit 2453050

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

zinit-install.zsh

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -473,26 +473,29 @@ builtin source "${ZINIT[BIN_DIR]}/zinit-side.zsh" || {
473473
}
474474
done
475475

476-
# Run annexes' atclone hooks (the after atclone-ice ones)
477-
reply=(
478-
${(on)ZINIT_EXTS2[(I)zinit hook:atclone-pre <->]}
479-
${(on)ZINIT_EXTS[(I)z-annex hook:atclone-<-> <->]}
480-
${(on)ZINIT_EXTS2[(I)zinit hook:atclone-post <->]}
481-
)
482-
for key in "${reply[@]}"; do
483-
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
484-
"${arr[5]}" plugin "$user" "$plugin" "$id_as" "$local_path" "${${key##(zinit|z-annex) hook:}%% <->}"
485-
hook_rc=$?
486-
[[ "$hook_rc" -ne 0 ]] && {
487-
retval="$hook_rc"
488-
builtin print -Pr -- "${ZINIT[col-warn]}Warning:%f%b ${ZINIT[col-obj]}${arr[5]}${ZINIT[col-warn]} hook returned with ${ZINIT[col-obj]}${hook_rc}${ZINIT[col-rst]}"
489-
}
490-
done
491476
}
492477

493478
return "$retval"
494479
) || return $?
495480

481+
if [[ $update != -u ]] {
482+
# Run annexes' atclone hooks (the after atclone-ice ones)
483+
reply=(
484+
${(on)ZINIT_EXTS2[(I)zinit hook:atclone-pre <->]}
485+
${(on)ZINIT_EXTS[(I)z-annex hook:atclone-<-> <->]}
486+
${(on)ZINIT_EXTS2[(I)zinit hook:atclone-post <->]}
487+
)
488+
local key hook_rc
489+
for key in "${reply[@]}"; do
490+
arr=( "${(Q)${(z@)ZINIT_EXTS[$key]:-$ZINIT_EXTS2[$key]}[@]}" )
491+
"${arr[5]}" plugin "$user" "$plugin" "$id_as" "$local_path" "${${key##(zinit|z-annex) hook:}%% <->}"
492+
hook_rc=$?
493+
[[ "$hook_rc" -ne 0 ]] && {
494+
retval="$hook_rc"
495+
builtin print -Pr -- "${ZINIT[col-warn]}Warning:%f%b ${ZINIT[col-obj]}${arr[5]}${ZINIT[col-warn]} hook returned with ${ZINIT[col-obj]}${hook_rc}${ZINIT[col-rst]}"
496+
}
497+
done
498+
}
496499
typeset -ga INSTALLED_EXECS
497500
{ INSTALLED_EXECS=( "${(@f)$(<${TMPDIR:-/tmp}/zinit-execs.$$.lst)}" ) } 2>/dev/null
498501

0 commit comments

Comments
 (0)