From 36a8f0c608aa43ef072ed28162238a4d15a7fe97 Mon Sep 17 00:00:00 2001 From: Matheus Araujo Date: Mon, 23 Feb 2026 14:06:25 -0300 Subject: [PATCH] fix: added a guard to avoid call twice when already closing --- lua/remote-nvim/providers/provider.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lua/remote-nvim/providers/provider.lua b/lua/remote-nvim/providers/provider.lua index d55dc026..4b8d11a1 100644 --- a/lua/remote-nvim/providers/provider.lua +++ b/lua/remote-nvim/providers/provider.lua @@ -809,8 +809,10 @@ function Provider:_wait_for_server_to_be_ready() -- This is synchronous but that's fine because the command we are running should immediately return local res = vim.fn.system(cmd) if res == "" then - timer:stop() - timer:close() + if not timer:is_closing() then + timer:stop() + timer:close() + end if co ~= nil and coroutine.status(co) == "suspended" then coroutine.resume(co) end @@ -825,8 +827,10 @@ function Provider:_wait_for_server_to_be_ready() -- Start the timer timer:start(timeout, 0, function() vim.notify(("Server did not come up on local in %s ms. Try again :("):format(timeout), vim.log.levels.ERROR) - timer:stop() - timer:close() + if not timer:is_closing() then + timer:stop() + timer:close() + end error(("Server did not come up on local in %s ms. Try again :("):format(timeout)) end) probe_server_readiness()