diff --git a/src/async.zsh b/src/async.zsh index eefdf4a..296c1c2 100644 --- a/src/async.zsh +++ b/src/async.zsh @@ -10,8 +10,9 @@ _zsh_autosuggest_async_request() { # If we've got a pending request, cancel it if [[ -n "$_ZSH_AUTOSUGGEST_ASYNC_FD" ]] && { true <&$_ZSH_AUTOSUGGEST_ASYNC_FD } 2>/dev/null; then - # Close the file descriptor + # Close the file descriptor and remove the handler exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&- + zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD # Assume the child process created a new process group and send # TERM to the group to attempt to kill all descendent processes diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 8169cc8..3e7560a 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -689,8 +689,9 @@ _zsh_autosuggest_async_request() { # If we've got a pending request, cancel it if [[ -n "$_ZSH_AUTOSUGGEST_ASYNC_FD" ]] && { true <&$_ZSH_AUTOSUGGEST_ASYNC_FD } 2>/dev/null; then - # Close the file descriptor + # Close the file descriptor and remove the handler exec {_ZSH_AUTOSUGGEST_ASYNC_FD}<&- + zle -F $_ZSH_AUTOSUGGEST_ASYNC_FD # Assume the child process created a new process group and send # TERM to the group to attempt to kill all descendent processes