mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-19 10:35:38 -07:00
parent
41de3c713c
commit
656ccef8dc
17
plug.vim
17
plug.vim
@ -722,15 +722,25 @@ function! s:assign_name()
|
||||
silent! execute 'f' fnameescape(name)
|
||||
endfunction
|
||||
|
||||
function! s:chsh(swap)
|
||||
let prev = [&shell, &shellredir]
|
||||
if !s:is_win && a:swap
|
||||
set shell=sh shellredir=>%s\ 2>&1
|
||||
endif
|
||||
return prev
|
||||
endfunction
|
||||
|
||||
function! s:bang(cmd, ...)
|
||||
try
|
||||
let [sh, shrd] = s:chsh(a:0)
|
||||
" FIXME: Escaping is incomplete. We could use shellescape with eval,
|
||||
" but it won't work on Windows.
|
||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
let cmd = a:0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
let g:_plug_bang = '!'.escape(cmd, '#!%')
|
||||
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
||||
finally
|
||||
unlet g:_plug_bang
|
||||
let [&shell, &shellredir] = [sh, shrd]
|
||||
endtry
|
||||
return v:shell_error ? 'Exit status: ' . v:shell_error : ''
|
||||
endfunction
|
||||
@ -1823,10 +1833,7 @@ endfunction
|
||||
|
||||
function! s:system(cmd, ...)
|
||||
try
|
||||
let [sh, shrd] = [&shell, &shellredir]
|
||||
if !s:is_win
|
||||
set shell=sh shellredir=>%s\ 2>&1
|
||||
endif
|
||||
let [sh, shrd] = s:chsh(1)
|
||||
let cmd = a:0 > 0 ? s:with_cd(a:cmd, a:1) : a:cmd
|
||||
return system(s:is_win ? '('.cmd.')' : cmd)
|
||||
finally
|
||||
|
@ -841,7 +841,12 @@ Execute (PlugUpdate!):
|
||||
Execute (When submodules are not initialized):
|
||||
call system(printf('cd %s && git submodule deinit subsubmodule', g:plugs['subsubmodule'].dir))
|
||||
|
||||
^ #481 submodule update should use standard shell
|
||||
let sh = &shell
|
||||
set sh=/bin/echo
|
||||
silent PlugUpdate!
|
||||
let &shell = sh
|
||||
unlet sh
|
||||
q
|
||||
AssertEqual ' ', system(printf('cd %s && git submodule status', g:plugs['subsubmodule'].dir))[0],
|
||||
\ 'subsubmodule/subsubmodule should be initialized'
|
||||
|
Loading…
Reference in New Issue
Block a user