fix: make_filter_cmd for :! powershell

Problem:
`Start-Process` requires the command to be split into the shell
command and its arguments. Previously it was done by parsing, which
didn't handle cases such as
  - commands with escaped space in their filepath
  - quoted commands with space in their filepath

Solution:
Use
  - `pwsh -Command` instead of `Start-Process`
  - `Get-Content` instead of `-RedirectStandardInput`
  - `Out-File` instead of `-RedirectStandardOutput`
This commit is contained in:
Enan Ajmain
2022-07-20 01:43:26 +06:00
parent ad6af3c1a9
commit b4d42bb905
4 changed files with 48 additions and 61 deletions

View File

@@ -642,12 +642,12 @@ describe('shell :!', function()
if iswin() then
feed(':4verbose %!sort /R<cr>')
screen:expect{
any=[[Executing command: .?Start%-Process sort %-ArgumentList "/R" %-RedirectStandardInput .* %-RedirectStandardOutput .* %-NoNewWindow %-Wait]]
any=[[Executing command: .?Get%-Content .* | & sort /R 2>&1 | Out%-File %-Encoding UTF8 .*; exit $LastExitCode]]
}
else
feed(':4verbose %!sort -r<cr>')
screen:expect{
any=[[Executing command: .?Start%-Process sort %-ArgumentList "%-r" %-RedirectStandardInput .* %-RedirectStandardOutput .* %-NoNewWindow %-Wait]]
any=[[Executing command: .?Get%-Content .* | & sort %-r 2>&1 | Out%-File %-Encoding UTF8 .*; exit $LastExitCode]]
}
end
feed('<CR>')