From 69ae31d402509b1b073c2984c9b018dddd561682 Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Tue, 16 Nov 2021 13:43:30 -0500 Subject: [PATCH] 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 --- autoload/fugitive.vim | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index e604c8a..a90fdc7 100644 --- a/autoload/fugitive.vim +++ b/autoload/fugitive.vim @@ -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)