fix: make_filter_cmd for :! powershell #15913

Problem:
Nvim fails to create tempfile "…/nvim6UJx04/7" when 'shell' is set to
pwsh (PowerShell Core). This breaks filtered shell commands ":{range}!".
With shell set to cmd, it works.

Solution:
PowerShell doesn't use "<" for stdin redirection. Instead, use
"-RedirectStandardInput".

Closes #15913
This commit is contained in:
Enan Ajmain
2021-11-09 20:22:21 +06:00
committed by Justin M. Keyes
parent b7084fef4c
commit 0b9664f524
4 changed files with 58 additions and 10 deletions

View File

@@ -525,9 +525,9 @@ function module.set_shell_powershell()
module.exec([[
let &shell = ']]..shell..[['
set shellquote= shellxquote=
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ]]..cmd..[['
let &shellpipe = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
let &shellredir = '-RedirectStandardOutput %s -NoNewWindow -Wait'
]])
end