Don't try to send :Git process CTRL-C when stdin is closed

Curiously, this appears to work anyways in Neovim, but not Vim.
This commit is contained in:
Tim Pope
2021-03-25 19:31:50 -04:00
parent 7de9b5a04b
commit 93b434949b

View File

@@ -2458,13 +2458,13 @@ function! s:RunWait(state, tmp, job) abort
if !exists('*jobwait') if !exists('*jobwait')
sleep 1m sleep 1m
endif endif
if !get(a:state, 'closed') if !get(a:state, 'closed_in')
let peek = getchar(1) let peek = getchar(1)
if peek != 0 && !(has('win32') && peek == 128) if peek != 0 && !(has('win32') && peek == 128)
let c = getchar() let c = getchar()
let c = type(c) == type(0) ? nr2char(c) : c let c = type(c) == type(0) ? nr2char(c) : c
if c ==# "\<C-D>" if c ==# "\<C-D>"
let a:state.closed = 1 let a:state.closed_in = 1
if type(a:job) ==# type(0) if type(a:job) ==# type(0)
call chanclose(a:job, 'stdin') call chanclose(a:job, 'stdin')
else else
@@ -2486,7 +2486,7 @@ function! s:RunWait(state, tmp, job) abort
finally finally
if !finished if !finished
try try
if a:state.pty if a:state.pty && !get(a:state, 'closed_in')
call s:RunSend(a:job, "\<C-C>") call s:RunSend(a:job, "\<C-C>")
elseif type(a:job) == type(0) elseif type(a:job) == type(0)
call jobstop(a:job) call jobstop(a:job)