Skip to content

Commit

Permalink
Need to prevent zpty feature detection from HUPing existing zptys
Browse files Browse the repository at this point in the history
  • Loading branch information
ericfreese committed Feb 17, 2017
1 parent c959408 commit c4bfd8e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions spec/integrations/client_zpty_spec.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
describe 'a running zpty command' do
let(:before_sourcing) { -> { session.run_command('zmodload zsh/zpty && zpty -b kitty cat') } }

it 'is not affected by running zsh-autosuggestions' do
session.run_command('zmodload zsh/zpty')
session.run_command('zpty -b kitty cat')
session.run_command('zpty -w kitty cat')
sleep 1
session.run_command('zpty -r kitty')
sleep 1 # Give a little time for precmd hooks to run
session.run_command('zpty -t kitty; echo $?')

wait_for(session.content).to end_with("\ncat")
wait_for(session.content).to end_with("\n0")
end
end
2 changes: 1 addition & 1 deletion src/features.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ _zsh_autosuggest_feature_detect() {
typeset -g _ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD
typeset -h REPLY

zpty $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME :
zpty $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME '{ zshexit() { kill -KILL $$; sleep 1 } }'

if (( REPLY )); then
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=1
Expand Down
2 changes: 1 addition & 1 deletion zsh-autosuggestions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ _zsh_autosuggest_feature_detect() {
typeset -g _ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD
typeset -h REPLY

zpty $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME :
zpty $ZSH_AUTOSUGGEST_ASYNC_PTY_NAME '{ zshexit() { kill -KILL $$; sleep 1 } }'

if (( REPLY )); then
_ZSH_AUTOSUGGEST_ZPTY_RETURNS_FD=1
Expand Down

0 comments on commit c4bfd8e

Please sign in to comment.