Ensure that kill succeeds even in older buggy versions of zsh

See https://unix.stackexchange.com/a/477647/156673
This commit is contained in:
Eric Freese 2019-06-14 21:27:21 -06:00
parent fdf4502c5c
commit e9ce05c4c1
2 changed files with 12 additions and 4 deletions

View file

@ -44,8 +44,12 @@ _zsh_autosuggest_capture_setup() {
# zpty processes.
if ! is-at-least 5.4; then
zshexit() {
kill -KILL $$
sleep 1 # Block for long enough for the signal to come through
# The zsh builtin `kill` fails sometimes in older versions
# https://unix.stackexchange.com/a/477647/156673
kill -KILL $$ 2>&- || command kill -KILL $$
# Block for long enough for the signal to come through
sleep 1
}
fi

View file

@ -526,8 +526,12 @@ _zsh_autosuggest_capture_setup() {
# zpty processes.
if ! is-at-least 5.4; then
zshexit() {
kill -KILL $$
sleep 1 # Block for long enough for the signal to come through
# The zsh builtin `kill` fails sometimes in older versions
# https://unix.stackexchange.com/a/477647/156673
kill -KILL $$ 2>&- || command kill -KILL $$
# Block for long enough for the signal to come through
sleep 1
}
fi