diff options
| author | William Boman <william@redwill.se> | 2022-12-26 17:43:01 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-26 17:43:01 +0100 |
| commit | 21a2475da458e97be798bdc9261da24460da5c65 (patch) | |
| tree | 7138d6b8d3badd52b738d773449c9a388a1af540 /lua/mason-core/managers/powershell/init.lua | |
| parent | feat(powershell): set $ErrorActionPreference = "Stop"; (#807) (diff) | |
| download | mason-21a2475da458e97be798bdc9261da24460da5c65.tar mason-21a2475da458e97be798bdc9261da24460da5c65.tar.gz mason-21a2475da458e97be798bdc9261da24460da5c65.tar.bz2 mason-21a2475da458e97be798bdc9261da24460da5c65.tar.lz mason-21a2475da458e97be798bdc9261da24460da5c65.tar.xz mason-21a2475da458e97be798bdc9261da24460da5c65.tar.zst mason-21a2475da458e97be798bdc9261da24460da5c65.zip | |
refactor: interact with libuv pipes in async context (#808)
Also now properly close pipes (shutdown -> close).
Diffstat (limited to 'lua/mason-core/managers/powershell/init.lua')
| -rw-r--r-- | lua/mason-core/managers/powershell/init.lua | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lua/mason-core/managers/powershell/init.lua b/lua/mason-core/managers/powershell/init.lua index 786645db..4133df23 100644 --- a/lua/mason-core/managers/powershell/init.lua +++ b/lua/mason-core/managers/powershell/init.lua @@ -1,4 +1,5 @@ local a = require "mason-core.async" +local async_uv = require "mason-core.async.uv" local spawn = require "mason-core.spawn" local process = require "mason-core.process" @@ -23,12 +24,12 @@ function M.script(script, opts, custom_spawn) "-NoProfile", on_spawn = a.scope(function(_, stdio) local stdin = stdio[1] - local write = a.promisify(vim.loop.write) - write(stdin, PWSHOPT.error_action_preference) - write(stdin, PWSHOPT.progress_preference) - write(stdin, PWSHOPT.security_protocol) - write(stdin, script) - stdin:shutdown() + async_uv.write(stdin, PWSHOPT.error_action_preference) + async_uv.write(stdin, PWSHOPT.progress_preference) + async_uv.write(stdin, PWSHOPT.security_protocol) + async_uv.write(stdin, script) + async_uv.shutdown(stdin) + async_uv.close(stdin) end), env_raw = process.graft_env(opts.env or {}, { "PSMODULEPATH" }), }, opts)) |
