commit e9f913ff8a6f76062e0aa95b60d740ec690f6f4f (tree)
parent 3a5d8c8770f6fc985f24b277583e80b0028d5727
Author: Tim Pope <code@tpope.net>
Date: Thu, 5 Aug 2021 17:04:47 -0400
Fix error message for system() failure with argument list
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim
@@ -520,6 +520,7 @@ function! fugitive#Prepare(...) abort
endfunction
function! s:SystemError(cmd, ...) abort
+ let cmd = type(a:cmd) == type([]) ? s:shellesc(a:cmd) : a:cmd
try
if &shellredir ==# '>' && &shell =~# 'sh\|cmd'
let shellredir = &shellredir
@@ -533,13 +534,13 @@ function! s:SystemError(cmd, ...) abort
let guioptions = &guioptions
set guioptions-=!
endif
- let out = call('system', [type(a:cmd) == type([]) ? s:shellesc(a:cmd) : a:cmd] + a:000)
+ let out = call('system', [cmd] + a:000)
return [out, v:shell_error]
catch /^Vim\%((\a\+)\)\=:E484:/
let opts = ['shell', 'shellcmdflag', 'shellredir', 'shellquote', 'shellxquote', 'shellxescape', 'shellslash']
call filter(opts, 'exists("+".v:val) && !empty(eval("&".v:val))')
call map(opts, 'v:val."=".eval("&".v:val)')
- call s:throw('failed to run `' . a:cmd . '` with ' . join(opts, ' '))
+ call s:throw('failed to run `' . cmd . '` with ' . join(opts, ' '))
finally
if exists('shellredir')
let &shellredir = shellredir