test(ui/messages2_spec): close unfinished timers at end of test (#35817)

The vim._extui.messages module uses multiple timers that last 2 or 4
seconds. If these timers aren't finished when a test ends, there will
be a 2-second delay on exit with ASAN or TSAN.
This commit is contained in:
zeertzjq
2025-09-18 08:01:21 +08:00
committed by GitHub
parent 5148c1247e
commit b5e6f44c08

View File

@@ -17,6 +17,17 @@ describe('messages2', function()
require('vim._extui').enable({})
end)
end)
after_each(function()
-- Since vim._extui lasts until Nvim exits, there may be unfinished timers.
-- Close unfinished timers to avoid 2s delay on exit with ASAN or TSAN.
exec_lua(function()
vim.uv.walk(function(handle)
if not handle:is_closing() then
handle:close()
end
end)
end)
end)
it('multiline messages and pager', function()
command('echo "foo\nbar"')