mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 05:43:52 -05:00
Allow close callback to run before leaving job wait loop
Apparently, both job_status() == "dead" and ch_status() == "closed" isn't enough to guarantee all callbacks have run. One last sleep seems to do the trick, but let's also add a sanity check because this can cause confusing, hard to debug behavior.
This commit is contained in:
@@ -2501,9 +2501,10 @@ endfunction
|
||||
function! s:RunTick(job) abort
|
||||
if type(a:job) == v:t_number
|
||||
return jobwait([a:job], 1)[0] == -1
|
||||
elseif type(a:job) == v:t_job && (ch_status(a:job) !=# 'closed' || job_status(a:job) ==# 'run')
|
||||
elseif type(a:job) == 8
|
||||
let running = ch_status(a:job) !=# 'closed' || job_status(a:job) ==# 'run'
|
||||
sleep 1m
|
||||
return ch_status(a:job) !=# 'closed' || job_status(a:job) ==# 'run'
|
||||
return running
|
||||
endif
|
||||
endfunction
|
||||
|
||||
@@ -2536,6 +2537,9 @@ function! s:RunWait(state, tmp, job) abort
|
||||
endif
|
||||
endif
|
||||
endwhile
|
||||
if !has_key(a:state, 'request') && has_key(a:state, 'job') && exists('*job_status') && job_status(a:job) ==# "dead"
|
||||
throw 'fugitive: close callback did not fire; this should never happen'
|
||||
endif
|
||||
call s:RunEcho(a:tmp)
|
||||
echo
|
||||
call s:RunEdit(a:state, a:tmp, a:job)
|
||||
|
||||
Reference in New Issue
Block a user