mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
fix(lua): disallow vim.wait() in fast contexts
`vim.wait()` cannot be called in a fast callback since the main loop cannot be run in that context as it is not reentrant Fixes #26122
This commit is contained in:
committed by
Lewis Russell
parent
6343d41436
commit
84bbe4b0ca
@@ -2769,6 +2769,19 @@ describe('lua stdlib', function()
|
||||
eq({'notification', 'wait', {-2}}, next_msg(500))
|
||||
end)
|
||||
end)
|
||||
|
||||
it('should not run in fast callbacks #26122', function()
|
||||
exec_lua([[
|
||||
vim.uv.new_timer():start(0, 100, function()
|
||||
local count = 0
|
||||
vim.wait(100, function()
|
||||
count = count + 1
|
||||
return count == 10
|
||||
end, 100)
|
||||
end)
|
||||
]])
|
||||
assert_alive()
|
||||
end)
|
||||
end)
|
||||
|
||||
it('vim.notify_once', function()
|
||||
|
||||
Reference in New Issue
Block a user