fix(vim.system): don't process non-fast events during wait() (#27300)

Problem:
Processing non-fast events during SystemObj:wait() may cause two pieces
of code to interfere with each other, and is different from jobwait().

Solution:
Don't process non-fast events during SystemObj:wait().
This commit is contained in:
zeertzjq
2024-02-02 21:52:01 +08:00
committed by GitHub
parent e98decf9a6
commit 9b7cf4f0be
2 changed files with 16 additions and 2 deletions

View File

@@ -94,14 +94,14 @@ function SystemObj:wait(timeout)
local done = vim.wait(timeout or state.timeout or MAX_TIMEOUT, function()
return state.result ~= nil
end)
end, nil, true)
if not done then
-- Send sigkill since this cannot be caught
self:_timeout(SIG.KILL)
vim.wait(timeout or state.timeout or MAX_TIMEOUT, function()
return state.result ~= nil
end)
end, nil, true)
end
return state.result