diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2020-09-06 10:34:44 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-06 10:34:44 -0700 |
| commit | d9dd30a955073d602741481d48e1c56d1fcae420 (patch) | |
| tree | 586c14820bc373568db0d9660583d0958f1d6d0f /test/functional/helpers.lua | |
| parent | c685a2ef487ebfffeb93274eee79d29c7e6bd6d1 (diff) | |
| parent | b2cef8b6650627f65c43029645942d46103a77df (diff) | |
Merge #12822 release-0.4 patchesrelease-0.4
Diffstat (limited to 'test/functional/helpers.lua')
| -rw-r--r-- | test/functional/helpers.lua | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index bd36bac062..dbaedd6f60 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -500,9 +500,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 |
