From f1ad2d864ab43c56bf86ce01be9971f62bc14f6c Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Mon, 17 Jun 2019 17:00:59 -0400 Subject: [PATCH] Escape batchfile path on Windows (#850) Close #832 --- plug.vim | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plug.vim b/plug.vim index 2c26070..bfafbfb 100644 --- a/plug.vim +++ b/plug.vim @@ -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\\" @@ -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) @@ -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