Browse Source

fix system call handling on windows (#575)

- ensure that all system calls go via installer.vim
  (vundle#installer#system, used to be s:system)
- escape/wrap complex command sequences
- log commands before trying to execute them
pull/589/head
Claus Reinke 11 years ago
parent
commit
dcf9c399cd
2 changed files with 14 additions and 8 deletions
  1. +12
    -6
      autoload/vundle/installer.vim
  2. +2
    -2
      autoload/vundle/scripts.vim

+ 12
- 6
autoload/vundle/installer.vim View File

@ -287,7 +287,7 @@ func! vundle#installer#delete(bang, dir_name) abort
let bundle = vundle#config#init_bundle(a:dir_name, {})
let cmd .= ' '.vundle#installer#shellesc(bundle.path())
let out = s:system(cmd)
let out = vundle#installer#system(cmd)
call s:log('')
call s:log('Plugin '.a:dir_name)
@ -347,7 +347,7 @@ endf
func! s:get_current_origin_url(bundle) abort
let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git config --get remote.origin.url'
let cmd = vundle#installer#shellesc_cd(cmd)
let out = s:strip(s:system(cmd))
let out = s:strip(vundle#installer#system(cmd))
return out
endf
@ -361,7 +361,7 @@ endf
func! s:get_current_sha(bundle)
let cmd = 'cd '.vundle#installer#shellesc(a:bundle.path()).' && git rev-parse HEAD'
let cmd = vundle#installer#shellesc_cd(cmd)
let out = s:system(cmd)[0:15]
let out = vundle#installer#system(cmd)[0:15]
return out
endf
@ -448,10 +448,10 @@ func! s:sync(bang, bundle) abort
return 'todate'
endif
let out = s:system(cmd)
call s:log('')
call s:log('Plugin '.a:bundle.name_spec)
call s:log(cmd, '$ ')
let out = vundle#installer#system(cmd)
call s:log(out, '> ')
if 0 != v:shell_error
@ -512,8 +512,14 @@ endf
" cmd -- the command passed to system() (string)
" return -- the return value from system()
" ---------------------------------------------------------------------------
func! s:system(cmd) abort
return system(a:cmd)
func! vundle#installer#system(cmd) abort
" would this suffice?
" return system('"'.a:cmd.'"')
let slash = &shellslash
set noshellslash
let result = system(shellescape(a:cmd))
if slash | set shellslash | endif
return result
endf


+ 2
- 2
autoload/vundle/scripts.vim View File

@ -85,7 +85,7 @@ func! s:create_changelog() abort
let cmd = vundle#installer#shellesc_cd(cmd)
let updates = system(cmd)
let updates = vundle#installer#system(cmd)
call add(changelog, '')
call add(changelog, 'Updated Plugin: '.bundle.name)
@ -239,7 +239,7 @@ func! s:fetch_scripts(to)
return 1
endif
call system(cmd)
call vundle#installer#system(cmd)
if (0 != v:shell_error)
echoerr 'Error fetching scripts!'


Loading…
Cancel
Save