aboutsummaryrefslogtreecommitdiff
path: root/test/functional/helpers.lua
diff options
context:
space:
mode:
Diffstat (limited to 'test/functional/helpers.lua')
-rw-r--r--test/functional/helpers.lua15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua
index c195983e93..20371b8ab0 100644
--- a/test/functional/helpers.lua
+++ b/test/functional/helpers.lua
@@ -501,9 +501,20 @@ function module.source(code)
end
function module.set_shell_powershell()
+ local shell = iswin() and 'powershell' or 'pwsh'
+ if not module.eval('executable("'..shell..'")') then
+ error(shell..' is not executable')
+ end
+ local aliases = iswin() and {'cat', 'sleep'} or {}
+ local cmd = ''
+ for _, alias in ipairs(aliases) do
+ cmd = cmd .. 'Remove-Item -Force alias:' .. alias .. ';'
+ end
module.source([[
- set shell=powershell shellquote=( shellpipe=\| shellredir=> shellxquote=
- let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command Remove-Item -Force alias:sleep; Remove-Item -Force alias:cat;'
+ let &shell = ']]..shell..[['
+ set shellquote= shellpipe=\| shellxquote=
+ let &shellredir = '| Out-File -Encoding UTF8'
+ let &shellcmdflag = '-NoLogo -NoProfile -ExecutionPolicy RemoteSigned -Command ]]..cmd..[['
]])
end