aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
authorEnan Ajmain <3nan.ajmain@gmail.com>2022-07-20 01:43:26 +0600
committerEnan Ajmain <3nan.ajmain@gmail.com>2022-09-30 21:07:45 +0600
commitb4d42bb9058308c38e3fe9d59458ce65b3f65eb0 (patch)
tree1a36a320f2a3498c8022e416478bf2e9b56e9c0a /test/functional/helpers.lua
parentad6af3c1a96f9fae0881c3dcb1f1989531a1073e (diff)
downloadrneovim-b4d42bb9058308c38e3fe9d59458ce65b3f65eb0.tar.gz
rneovim-b4d42bb9058308c38e3fe9d59458ce65b3f65eb0.tar.bz2
rneovim-b4d42bb9058308c38e3fe9d59458ce65b3f65eb0.zip
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`
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index 3aec834bea..4fcc190dee 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -562,16 +562,16 @@ function module.set_shell_powershell(fake)
assert(found)
end
local shell = found and (iswin() and 'powershell' or 'pwsh') or module.testprg('pwsh-test')
- local set_encoding = '[Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.Encoding]::UTF8;'
+ local set_encoding = '[Console]::InputEncoding=[Console]::OutputEncoding=[System.Text.UTF8Encoding]::new();'
local cmd = set_encoding..'Remove-Item -Force '..table.concat(iswin()
- and {'alias:cat', 'alias:echo', 'alias:sleep'}
+ and {'alias:cat', 'alias:echo', 'alias:sleep', 'alias:sort'}
or {'alias:echo'}, ',')..';'
module.exec([[
let &shell = ']]..shell..[['
set shellquote= shellxquote=
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'
+ let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s; exit $LastExitCode'
]])
return found
end