Fix shell detection, Fix shellescape on batchfile
&shell could be escaped on because of spaces. See patch-8.0.1455 and related 8.1.x patches that address this for $SHELL on Unix and git-bash on Windows.
This commit is contained in:
parent
54b5493eae
commit
da128c45fd
8
plug.vim
8
plug.vim
|
@ -369,8 +369,8 @@ if s:is_win
|
||||||
function! s:batchfile(cmd)
|
function! s:batchfile(cmd)
|
||||||
let batchfile = tempname().'.bat'
|
let batchfile = tempname().'.bat'
|
||||||
call writefile(s:wrap_cmds(a:cmd), batchfile)
|
call writefile(s:wrap_cmds(a:cmd), batchfile)
|
||||||
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 1})
|
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
|
||||||
if &shell =~# 'powershell\.exe$'
|
if &shell =~# 'powershell\.exe'
|
||||||
let cmd = '& ' . cmd
|
let cmd = '& ' . cmd
|
||||||
endif
|
endif
|
||||||
return [batchfile, cmd]
|
return [batchfile, cmd]
|
||||||
|
@ -2005,9 +2005,9 @@ function! plug#shellescape(arg, ...)
|
||||||
let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {}
|
let opts = a:0 > 0 && type(a:1) == s:TYPE.dict ? a:1 : {}
|
||||||
let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh')
|
let shell = get(opts, 'shell', s:is_win ? 'cmd.exe' : 'sh')
|
||||||
let script = get(opts, 'script', 1)
|
let script = get(opts, 'script', 1)
|
||||||
if shell =~# 'cmd\.exe$'
|
if shell =~# 'cmd\.exe'
|
||||||
return s:shellesc_cmd(a:arg, script)
|
return s:shellesc_cmd(a:arg, script)
|
||||||
elseif shell =~# 'powershell\.exe$' || shell =~# 'pwsh$'
|
elseif shell =~# 'powershell\.exe' || shell =~# 'pwsh$'
|
||||||
return s:shellesc_ps1(a:arg)
|
return s:shellesc_ps1(a:arg)
|
||||||
endif
|
endif
|
||||||
return shellescape(a:arg)
|
return shellescape(a:arg)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user