diff options
| author | William Boman <william@redwill.se> | 2023-04-08 13:52:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-08 13:52:39 +0200 |
| commit | 33e0d59e52dd6da0f48f0052c63dfa9ef98a8229 (patch) | |
| tree | 80e58653073fab20252187c040e31ff4e5fb11bc /tests/mason-core | |
| parent | chore: autogenerate (#1195) (diff) | |
| download | mason-33e0d59e52dd6da0f48f0052c63dfa9ef98a8229.tar mason-33e0d59e52dd6da0f48f0052c63dfa9ef98a8229.tar.gz mason-33e0d59e52dd6da0f48f0052c63dfa9ef98a8229.tar.bz2 mason-33e0d59e52dd6da0f48f0052c63dfa9ef98a8229.tar.lz mason-33e0d59e52dd6da0f48f0052c63dfa9ef98a8229.tar.xz mason-33e0d59e52dd6da0f48f0052c63dfa9ef98a8229.tar.zst mason-33e0d59e52dd6da0f48f0052c63dfa9ef98a8229.zip | |
fix(powershell): close stdin (#1197)
Diffstat (limited to 'tests/mason-core')
| -rw-r--r-- | tests/mason-core/managers/powershell_spec.lua | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/mason-core/managers/powershell_spec.lua b/tests/mason-core/managers/powershell_spec.lua index 297c85ae..56ec243e 100644 --- a/tests/mason-core/managers/powershell_spec.lua +++ b/tests/mason-core/managers/powershell_spec.lua @@ -1,4 +1,3 @@ -local a = require "mason-core.async" local match = require "luassert.match" local mock = require "luassert.mock" local spawn = require "mason-core.spawn" @@ -65,4 +64,28 @@ describe("powershell manager", function() [[ $ErrorActionPreference = "Stop"; $ProgressPreference = 'SilentlyContinue'; [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; echo 'Is this bash?']], }) end) + + it("should close stdin", function() + local stdin = { + close = spy.new(), + } + stub( + spawn, + "pwsh", + ---@param args SpawnArgs + function(args) + args.on_spawn(mock.new(), { + stdin, + }, 1) + end + ) + stub(vim.fn, "executable") + vim.fn.executable.on_call_with("pwsh").returns(1) + + powershell().command "Powershell-Command" + + assert.spy(spawn.pwsh).was_called(1) + assert.spy(stdin.close).was_called(1) + assert.spy(stdin.close).was_called_with(match.is_ref(stdin)) + end) end) |
