fix(health): stop job properly on timeout (#23877)

This commit is contained in:
zeertzjq 2023-06-02 17:23:45 +08:00 committed by GitHub
parent 9f3c4c1526
commit 843c1bed95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,13 +109,13 @@ local function system(cmd, ...)
end
if not is_blank(stdin) then
vim.cmd([[call jobsend(jobid, stdin)]])
vim.api.nvim_chan_send(jobid, stdin)
end
local res = vim.fn.jobwait({ jobid }, 30000)
if res[1] == -1 then
error('Command timed out: ' .. shellify(cmd))
vim.cmd([[call jobstop(jobid)]])
vim.fn.jobstop(jobid)
elseif shell_error() and not ignore_error then
local emsg = 'Command error (job='
.. jobid