From e9f913ff8a6f76062e0aa95b60d740ec690f6f4f Mon Sep 17 00:00:00 2001 From: Tim Pope Date: Thu, 5 Aug 2021 17:04:47 -0400 Subject: [PATCH] Fix error message for system() failure with argument list --- autoload/fugitive.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/fugitive.vim b/autoload/fugitive.vim index 528c6d0..513c6c3 100644 --- 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