Use %1 instead of tracking pid

This commit is contained in:
Eric Freese 2017-01-24 19:56:34 -07:00
parent 0308ed797e
commit fba20b042e
2 changed files with 2 additions and 12 deletions

View file

@ -13,17 +13,12 @@ _zsh_autosuggest_async_fetch_suggestion() {
# Pty is spawned running this function # Pty is spawned running this function
_zsh_autosuggest_async_suggestion_server() { _zsh_autosuggest_async_suggestion_server() {
local last_pid
while read -d $'\0' cmd; do while read -d $'\0' cmd; do
# Kill last bg process # Kill last bg process
kill -KILL $last_pid &>/dev/null kill -KILL %1 &>/dev/null
# Run suggestion search in the background # Run suggestion search in the background
print -n -- "$(eval "$cmd")"$'\0' & print -n -- "$(eval "$cmd")"$'\0' &
# Save the bg process's id so we can kill later
last_pid=$!
done done
} }

View file

@ -488,17 +488,12 @@ _zsh_autosuggest_async_fetch_suggestion() {
# Pty is spawned running this function # Pty is spawned running this function
_zsh_autosuggest_async_suggestion_server() { _zsh_autosuggest_async_suggestion_server() {
local last_pid
while read -d $'\0' cmd; do while read -d $'\0' cmd; do
# Kill last bg process # Kill last bg process
kill -KILL $last_pid &>/dev/null kill -KILL %1 &>/dev/null
# Run suggestion search in the background # Run suggestion search in the background
print -n -- "$(eval "$cmd")"$'\0' & print -n -- "$(eval "$cmd")"$'\0' &
# Save the bg process's id so we can kill later
last_pid=$!
done done
} }