Set shellredir on Windows

Prep to use list type for command  passed to s:system() within s:spawn()
This commit is contained in:
Jan Edmund Lazo 2020-04-08 06:18:32 -04:00
parent ba7ddedb9a
commit d9f7328268
No known key found for this signature in database
GPG Key ID: 64915E6E9F735B15

View File

@ -864,8 +864,15 @@ endfunction
function! s:chsh(swap)
let prev = [&shell, &shellcmdflag, &shellredir]
if !s:is_win && a:swap
set shell=sh shellredir=>%s\ 2>&1
if !s:is_win
set shell=sh
endif
if a:swap
if &shell =~# 'powershell\.exe' || &shell =~# 'pwsh$'
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
elseif &shell =~# 'sh' || &shell =~# 'cmd\.exe'
set shellredir=>%s\ 2>&1
endif
endif
return prev
endfunction