Skip to content

Commit

Permalink
Escape batchfile path on Windows (junegunn#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
janlazo authored and junegunn committed Jun 17, 2019
1 parent 08e78d8 commit f1ad2d8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ function! s:bang(cmd, ...)
if s:is_win
let batchfile = tempname().'.bat'
call writefile(["@echo off\r", cmd . "\r"], batchfile)
let cmd = batchfile
let cmd = s:shellesc(batchfile)
endif
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
Expand Down Expand Up @@ -1210,7 +1210,7 @@ function! s:spawn(name, cmd, opts)
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
if !empty(job.batchfile)
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
let cmd = job.batchfile
let cmd = s:shellesc(job.batchfile)
endif
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)

Expand Down Expand Up @@ -2037,9 +2037,9 @@ function! s:system(cmd, ...)
if s:is_win
let batchfile = tempname().'.bat'
call writefile(["@echo off\r", cmd . "\r"], batchfile)
let cmd = batchfile
let cmd = s:shellesc(batchfile)
endif
return system(s:is_win ? '('.cmd.')' : cmd)
return system(cmd)
finally
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
if s:is_win
Expand Down

0 comments on commit f1ad2d8

Please sign in to comment.