@@ -665,21 +665,17 @@ else
665665 let s: launcher = function (' s:xterm_launcher' )
666666endif
667667
668- function ! s: exit_handler (code, command , ... )
669- if a: code == 130
670- return 0
671- elseif has (' nvim' ) && a: code == 129
672- " When deleting the terminal buffer while fzf is still running,
673- " Nvim sends SIGHUP.
674- return 0
675- elseif a: code > 1
668+ function ! s: exit_handler (dict , code, command , ... )
669+ if has_key (a: dict , ' exit' )
670+ call a: dict .exit (a: code )
671+ endif
672+ if a: code == 2
676673 call s: error (' Error running ' . a: command )
677674 if ! empty (a: 000 )
678675 sleep
679676 endif
680- return 0
681677 endif
682- return 1
678+ return a: code
683679endfunction
684680
685681function ! s: execute (dict , command , use_height, temps) abort
@@ -731,7 +727,7 @@ function! s:execute(dict, command, use_height, temps) abort
731727 let exit_status = v: shell_error
732728 redraw !
733729 let lines = s: collect (a: temps )
734- return s: exit_handler (exit_status, command ) ? lines : []
730+ return s: exit_handler (a: dict , exit_status, command ) == 0 ? lines : []
735731endfunction
736732
737733function ! s: execute_tmux (dict , command , temps) abort
@@ -746,7 +742,7 @@ function! s:execute_tmux(dict, command, temps) abort
746742 let exit_status = v: shell_error
747743 redraw !
748744 let lines = s: collect (a: temps )
749- return s: exit_handler (exit_status, command ) ? lines : []
745+ return s: exit_handler (a: dict , exit_status, command ) == 0 ? lines : []
750746endfunction
751747
752748function ! s: calc_size (max , val, dict )
@@ -912,7 +908,7 @@ function! s:execute_term(dict, command, temps) abort
912908 endif
913909
914910 let lines = s: collect (self .temps)
915- if ! s: exit_handler (a: code , self .command , 1 )
911+ if s: exit_handler (self . dict , a: code , self .command , 1 ) != 0
916912 return
917913 endif
918914
0 commit comments