diff --git a/src/async.zsh b/src/async.zsh index b330ccf..91c3587 100644 --- a/src/async.zsh +++ b/src/async.zsh @@ -13,17 +13,12 @@ _zsh_autosuggest_async_fetch_suggestion() { # Pty is spawned running this function _zsh_autosuggest_async_suggestion_server() { - local last_pid - while read -d $'\0' cmd; do # Kill last bg process - kill -KILL $last_pid &>/dev/null + kill -KILL %1 &>/dev/null # Run suggestion search in the background print -n -- "$(eval "$cmd")"$'\0' & - - # Save the bg process's id so we can kill later - last_pid=$! done } diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 2b0465a..f99953b 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -488,17 +488,12 @@ _zsh_autosuggest_async_fetch_suggestion() { # Pty is spawned running this function _zsh_autosuggest_async_suggestion_server() { - local last_pid - while read -d $'\0' cmd; do # Kill last bg process - kill -KILL $last_pid &>/dev/null + kill -KILL %1 &>/dev/null # Run suggestion search in the background print -n -- "$(eval "$cmd")"$'\0' & - - # Save the bg process's id so we can kill later - last_pid=$! done }