fix: :! pwsh redirection for command not found

Problem:
If the shell command passed to the filtered bang command isn't found,
the error isn't redirected to the temp.out file when shell is set to
powershell.

Solution: Use anonymous function with Invoke-Command operator (&).
(cherry picked from commit f2482b3b53)
This commit is contained in:
Enan Ajmain
2022-07-20 20:55:28 +06:00
committed by github-actions[bot]
parent bb9c5c3f60
commit ce422ba763
2 changed files with 5 additions and 4 deletions

View File

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