mirror of
https://github.com/tpope/vim-fugitive.git
synced 2025-11-13 13:53:51 -05:00
Fix error message for system() failure with argument list
This commit is contained in:
@@ -520,6 +520,7 @@ function! fugitive#Prepare(...) abort
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:SystemError(cmd, ...) abort
|
function! s:SystemError(cmd, ...) abort
|
||||||
|
let cmd = type(a:cmd) == type([]) ? s:shellesc(a:cmd) : a:cmd
|
||||||
try
|
try
|
||||||
if &shellredir ==# '>' && &shell =~# 'sh\|cmd'
|
if &shellredir ==# '>' && &shell =~# 'sh\|cmd'
|
||||||
let shellredir = &shellredir
|
let shellredir = &shellredir
|
||||||
@@ -533,13 +534,13 @@ function! s:SystemError(cmd, ...) abort
|
|||||||
let guioptions = &guioptions
|
let guioptions = &guioptions
|
||||||
set guioptions-=!
|
set guioptions-=!
|
||||||
endif
|
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]
|
return [out, v:shell_error]
|
||||||
catch /^Vim\%((\a\+)\)\=:E484:/
|
catch /^Vim\%((\a\+)\)\=:E484:/
|
||||||
let opts = ['shell', 'shellcmdflag', 'shellredir', 'shellquote', 'shellxquote', 'shellxescape', 'shellslash']
|
let opts = ['shell', 'shellcmdflag', 'shellredir', 'shellquote', 'shellxquote', 'shellxescape', 'shellslash']
|
||||||
call filter(opts, 'exists("+".v:val) && !empty(eval("&".v:val))')
|
call filter(opts, 'exists("+".v:val) && !empty(eval("&".v:val))')
|
||||||
call map(opts, 'v:val."=".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
|
finally
|
||||||
if exists('shellredir')
|
if exists('shellredir')
|
||||||
let &shellredir = shellredir
|
let &shellredir = shellredir
|
||||||
|
|||||||
Reference in New Issue
Block a user