From fba20b042e89fac0932e01c08a41602e77158ca2 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Tue, 24 Jan 2017 19:56:34 -0700 Subject: [PATCH] Use %1 instead of tracking pid --- src/async.zsh | 7 +------ zsh-autosuggestions.zsh | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) 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 }