fix(explorer.watch): pcall watcher, since it can give errors on windows

This commit is contained in:
Folke Lemaitre 2025-02-04 18:59:04 +01:00
parent bc87992e71
commit af968181af
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -21,7 +21,7 @@ local running = {} ---@type table<string, fun()>
function M.abort()
for _, abort in pairs(running) do
abort()
pcall(abort)
end
running = {}
end
@ -38,6 +38,7 @@ function M.watch(cwd)
end
M.abort()
pcall(function()
local timer = assert(uv.new_timer())
local cancel = watch(cwd, {
uvflags = { recursive = true },
@ -69,6 +70,7 @@ function M.watch(cwd)
end
cancel()
end
end)
end
return M