escape shell commands for windows

inspired by
https://github.com/gmarik/vundle/pull/228 and
https://github.com/gmarik/vundle/pull/172

Vim patch #445 changed shell escaping and introduced incompatabilities for vundle.
Now vundle only escapes joined commands with double quotes on windows when shellxquote is not set to '('.
This workaround closes https://github.com/gmarik/vundle/issues/146 - the mentioned workaround
is no longer needed, but it does not break a vim configurations which contains "set shellxquote=".

DRY shell escaping and modified (hopefully) all relevant places.
This commit is contained in:
robi-wan
2012-11-28 19:47:20 +01:00
parent 3bf598d169
commit b5bef26e2c
2 changed files with 23 additions and 9 deletions

View File

@@ -43,10 +43,7 @@ func! s:create_changelog() abort
\ ' && git log --pretty=format:"%s %an, %ar" --graph '.
\ initial_sha.'..'.updated_sha
if (has('win32') || has('win64'))
let cmd = substitute(cmd, '^cd ','cd /d ','') " add /d switch to change drives
let cmd = '"'.cmd.'"' " enclose in quotes
endif
let cmd = g:shellesc_cd(cmd)
let updates = system(cmd)
@@ -164,7 +161,7 @@ func! s:fetch_scripts(to)
let cmd = 'wget -q -O '.temp.' '.l:vim_scripts_json. ' && mv -f '.temp.' '.shellescape(a:to)
if (has('win32') || has('win64'))
let cmd = substitute(cmd, 'mv -f ', 'move /Y ', '') " change force flag
let cmd = '"'.cmd.'"' " enclose in quotes so && joined cmds work
let cmd = g:shellesc(cmd)
end
else
echoerr 'Error curl or wget is not available!'