@@ -726,9 +726,9 @@ _zsh_autosuggest_fetch_suggestion() {
726
726
# Async #
727
727
# --------------------------------------------------------------------#
728
728
729
- zmodload zsh/system
730
-
731
729
_zsh_autosuggest_async_request () {
730
+ zmodload zsh/system 2> /dev/null # For `$sysparams`
731
+
732
732
typeset -g _ZSH_AUTOSUGGEST_ASYNC_FD _ZSH_AUTOSUGGEST_CHILD_PID
733
733
734
734
# If we've got a pending request, cancel it
@@ -737,17 +737,20 @@ _zsh_autosuggest_async_request() {
737
737
exec {_ZSH_AUTOSUGGEST_ASYNC_FD}< & -
738
738
zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD
739
739
740
- # Zsh will make a new process group for the child process only if job
741
- # control is enabled (MONITOR option)
742
- if [[ -o MONITOR ]]; then
743
- # Send the signal to the process group to kill any processes that may
744
- # have been forked by the suggestion strategy
745
- kill -TERM -$_ZSH_AUTOSUGGEST_CHILD_PID 2> /dev/null
746
- else
747
- # Kill just the child process since it wasn't placed in a new process
748
- # group. If the suggestion strategy forked any child processes they may
749
- # be orphaned and left behind.
750
- kill -TERM $_ZSH_AUTOSUGGEST_CHILD_PID 2> /dev/null
740
+ # We won't know the pid unless the user has zsh/system module installed
741
+ if [[ -n " $_ZSH_AUTOSUGGEST_CHILD_PID " ]]; then
742
+ # Zsh will make a new process group for the child process only if job
743
+ # control is enabled (MONITOR option)
744
+ if [[ -o MONITOR ]]; then
745
+ # Send the signal to the process group to kill any processes that may
746
+ # have been forked by the suggestion strategy
747
+ kill -TERM -$_ZSH_AUTOSUGGEST_CHILD_PID 2> /dev/null
748
+ else
749
+ # Kill just the child process since it wasn't placed in a new process
750
+ # group. If the suggestion strategy forked any child processes they may
751
+ # be orphaned and left behind.
752
+ kill -TERM $_ZSH_AUTOSUGGEST_CHILD_PID 2> /dev/null
753
+ fi
751
754
fi
752
755
fi
753
756
0 commit comments