fix(lsp): avoid pipe leaks if lsp cmd isn't executable (#19717)

The `onexit` handler isn't called if `uv.spawn` doesn't return a handle.
This commit is contained in:
Mathias Fußenegger
2022-08-11 17:04:55 +02:00
committed by GitHub
parent 8b67f37798
commit 996fc2256b

View File

@@ -340,6 +340,9 @@ local function start(cmd, cmd_args, dispatchers, extra_spawn_params)
end
handle, pid = uv.spawn(cmd, spawn_params, onexit)
if handle == nil then
stdin:close()
stdout:close()
stderr:close()
local msg = string.format('Spawning language server with cmd: `%s` failed', cmd)
if string.match(pid, 'ENOENT') then
msg = msg