diff --git a/spec/async_spec.rb b/spec/async_spec.rb index 9405fb2..0bcbaa1 100644 --- a/spec/async_spec.rb +++ b/spec/async_spec.rb @@ -26,6 +26,16 @@ context 'with asynchronous suggestions enabled' do end end end + + describe 'exiting a subshell' do + it 'should not cause error messages to be printed' do + session.run_command('$(exit)') + + sleep 1 + + expect(session.content).to eq('$(exit)') + end + end end diff --git a/src/async.zsh b/src/async.zsh index de55e1d..9a0cfaa 100644 --- a/src/async.zsh +++ b/src/async.zsh @@ -83,13 +83,11 @@ _zsh_autosuggest_async_pty_create() { } _zsh_autosuggest_async_pty_destroy() { - if zpty -t $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null; then - # Remove the input handler - zle -F $_ZSH_AUTOSUGGEST_PTY_FD &>/dev/null + # Remove the input handler + zle -F $_ZSH_AUTOSUGGEST_PTY_FD &>/dev/null - # Destroy the zpty - zpty -d $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null - fi + # Destroy the zpty + zpty -d $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null } _zsh_autosuggest_async_pty_recreate() { diff --git a/zsh-autosuggestions.zsh b/zsh-autosuggestions.zsh index 7f6e7de..3443469 100644 --- a/zsh-autosuggestions.zsh +++ b/zsh-autosuggestions.zsh @@ -661,13 +661,11 @@ _zsh_autosuggest_async_pty_create() { } _zsh_autosuggest_async_pty_destroy() { - if zpty -t $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null; then - # Remove the input handler - zle -F $_ZSH_AUTOSUGGEST_PTY_FD &>/dev/null + # Remove the input handler + zle -F $_ZSH_AUTOSUGGEST_PTY_FD &>/dev/null - # Destroy the zpty - zpty -d $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null - fi + # Destroy the zpty + zpty -d $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME &>/dev/null } _zsh_autosuggest_async_pty_recreate() {