diff options
| -rw-r--r-- | lua/mason-core/installer/managers/powershell.lua | 2 | ||||
| -rw-r--r-- | lua/mason/health.lua | 7 | ||||
| -rw-r--r-- | tests/mason-core/installer/managers/powershell_spec.lua | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/lua/mason-core/installer/managers/powershell.lua b/lua/mason-core/installer/managers/powershell.lua index 0e7f4145..372426e8 100644 --- a/lua/mason-core/installer/managers/powershell.lua +++ b/lua/mason-core/installer/managers/powershell.lua @@ -8,7 +8,7 @@ local M = {} local PWSHOPT = { progress_preference = [[ $ProgressPreference = 'SilentlyContinue'; ]], -- https://stackoverflow.com/a/63301751 security_protocol = [[ [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ]], - error_action_preference = [[ $ErrorActionPreference = "Stop"; ]], + error_action_preference = [[ $ErrorActionPreference = 'Stop'; ]], } local powershell = _.lazy(function() diff --git a/lua/mason/health.lua b/lua/mason/health.lua index e439736a..557fdc5f 100644 --- a/lua/mason/health.lua +++ b/lua/mason/health.lua @@ -113,14 +113,15 @@ local function check_core_utils() end if platform.is.win then + local powershell = vim.fn.executable "pwsh" == 1 and "pwsh" or "powershell" check { - cmd = "pwsh", + cmd = powershell, args = { "-NoProfile", "-Command", - [[$PSVersionTable.PSVersion, $PSVersionTable.OS, $PSVersionTable.Platform -join " "]], + [[$PSVersionTable.PSVersion, $PSVersionTable.OS, $PSVersionTable.Platform -join ' ']], }, - name = "pwsh", + name = powershell, } check { cmd = "7z", args = { "--help" }, name = "7z", relaxed = true } end diff --git a/tests/mason-core/installer/managers/powershell_spec.lua b/tests/mason-core/installer/managers/powershell_spec.lua index 14478305..5560c4f2 100644 --- a/tests/mason-core/installer/managers/powershell_spec.lua +++ b/tests/mason-core/installer/managers/powershell_spec.lua @@ -69,7 +69,7 @@ describe("powershell manager", function() "-NoProfile", "-NonInteractive", "-Command", - [[ $ErrorActionPreference = "Stop"; $ProgressPreference = 'SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; echo 'Is this bash?']], + [[ $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; echo 'Is this bash?']], }) end) |
