mirror of
https://github.com/zsh-users/zsh-autosuggestions.git
synced 2024-11-18 09:51:06 +01:00
Use %1 instead of tracking pid
This commit is contained in:
parent
0308ed797e
commit
fba20b042e
2 changed files with 2 additions and 12 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue