mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-09 21:28:10 +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()
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue