mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-10 21:58:16 +00:00
fix(explorer.watch): pcall watcher, since it can give errors on windows
This commit is contained in:
parent
bc87992e71
commit
af968181af
1 changed files with 30 additions and 28 deletions
|
@ -21,7 +21,7 @@ local running = {} ---@type table<string, fun()>
|
||||||
|
|
||||||
function M.abort()
|
function M.abort()
|
||||||
for _, abort in pairs(running) do
|
for _, abort in pairs(running) do
|
||||||
abort()
|
pcall(abort)
|
||||||
end
|
end
|
||||||
running = {}
|
running = {}
|
||||||
end
|
end
|
||||||
|
@ -38,6 +38,7 @@ function M.watch(cwd)
|
||||||
end
|
end
|
||||||
M.abort()
|
M.abort()
|
||||||
|
|
||||||
|
pcall(function()
|
||||||
local timer = assert(uv.new_timer())
|
local timer = assert(uv.new_timer())
|
||||||
local cancel = watch(cwd, {
|
local cancel = watch(cwd, {
|
||||||
uvflags = { recursive = true },
|
uvflags = { recursive = true },
|
||||||
|
@ -69,6 +70,7 @@ function M.watch(cwd)
|
||||||
end
|
end
|
||||||
cancel()
|
cancel()
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue