From e9ce05c4c1aaff9aef12ddc375e718fd4e41d9c9 Mon Sep 17 00:00:00 2001 From: Eric Freese Date: Fri, 14 Jun 2019 21:27:21 -0600 Subject: [PATCH] Ensure that `kill` succeeds even in older buggy versions of zsh See https://unix.stackexchange.com/a/477647/156673 --- src/strategies/completion.zsh | 8 ++++++-- zsh-autosuggestions.zsh | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/strategies/completion.zsh b/src/strategies/completion.zsh index f869aa2..246f0bd 100644 --- a/src/strategies/completion.zsh +++ b/src/strategies/completion.zsh @@ -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 diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index ffc0a1a..753228e 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -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