Check for ch_close_in() to ensure full Vim jobs support

Resolves: https://github.com/tpope/vim-fugitive/issues/1973
This commit is contained in:
Tim Pope
2022-04-12 19:51:42 -04:00
parent cba863444c
commit a252be79c0

View File

@@ -341,7 +341,7 @@ function! s:JobExecute(argv, jopts, stdin, callback, ...) abort
call chansend(dict.job, a:stdin) call chansend(dict.job, a:stdin)
call chanclose(dict.job, 'stdin') call chanclose(dict.job, 'stdin')
endif endif
elseif exists('*job_start') elseif exists('*ch_close_in')
let temp = tempname() let temp = tempname()
call extend(a:jopts, { call extend(a:jopts, {
\ 'out_io': 'file', \ 'out_io': 'file',
@@ -392,7 +392,7 @@ endfunction
" Section: Git " Section: Git
let s:run_jobs = (exists('*job_start') || exists('*jobstart')) && exists('*bufwinid') let s:run_jobs = (exists('*ch_close_in') || exists('*jobstart')) && exists('*bufwinid')
function! s:GitCmd() abort function! s:GitCmd() abort
if !exists('g:fugitive_git_executable') if !exists('g:fugitive_git_executable')
@@ -790,7 +790,7 @@ function! s:SystemList(cmd) abort
call remove(lines, -1) call remove(lines, -1)
endif endif
return [lines, exit[0]] return [lines, exit[0]]
elseif exists('*job_start') elseif exists('*ch_close_in')
let lines = [] let lines = []
let jopts = { let jopts = {
\ 'out_cb': { j, str -> add(lines, str) }, \ 'out_cb': { j, str -> add(lines, str) },
@@ -904,7 +904,7 @@ function! s:StdoutToFile(out, cmd, ...) abort
call writefile(jopts.stdout, a:out, 'b') call writefile(jopts.stdout, a:out, 'b')
endif endif
return [join(jopts.stderr, "\n"), exit[0]] return [join(jopts.stderr, "\n"), exit[0]]
elseif exists('*job_start') elseif exists('*ch_close_in')
try try
let err = tempname() let err = tempname()
call extend(jopts, { call extend(jopts, {
@@ -3809,7 +3809,7 @@ function! fugitive#Command(line1, line2, range, bang, mods, arg) abort
if has_key(tmp, 'echo') if has_key(tmp, 'echo')
echo "" echo ""
endif endif
if exists('*job_start') if exists('*ch_close_in')
call extend(jobopts, { call extend(jobopts, {
\ 'mode': 'raw', \ 'mode': 'raw',
\ 'out_cb': function('s:RunReceive', [state, tmp, 'out']), \ 'out_cb': function('s:RunReceive', [state, tmp, 'out']),