Fix command execution on Vim 7

This worked on my test environment of 7.4.888, but did not work on
7.4.000.

References: https://github.com/tpope/vim-fugitive/issues/1889
This commit is contained in:
Tim Pope
2021-11-16 13:43:30 -05:00
parent f9c0b8eafe
commit 69ae31d402

View File

@@ -341,12 +341,19 @@ function! s:JobExecute(argv, jopts, stdin, callback, ...) abort
let cmd = s:shellesc(a:argv)
let outfile = tempname()
try
let dict.stderr = split(system(' (' . cmd . ' >' . outfile . ') ', join(a:stdin, "\n")), "\n", 1)
if len(a:stdin)
call writefile(a:stdin, outfile . '.in', 'b')
let cmd = ' (' . cmd . ' >' . outfile . ' <' . outfile . '.in) '
else
let cmd = ' (' . cmd . ' >' . outfile . ') '
endif
let dict.stderr = split(system(cmd), "\n", 1)
let dict.exit_status = v:shell_error
let dict.stdout = readfile(outfile, 'b')
call call(cb[0], [dict] + cb[1:-1])
finally
call delete(outfile)
call delete(outfile . '.in')
endtry
endif
if empty(a:callback)