Skip to content

Commit 1b13a49

Browse files
authored
fix(#1916): suppress EPERM watcher failures on windows (#1919)
1 parent 1f0fc8d commit 1b13a49

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

doc/nvim-tree-lua.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1724,5 +1724,6 @@ Windows WSL and PowerShell
17241724
- Trash is unavailable
17251725
- Executable file detection is disabled as this is non-performant and can
17261726
freeze nvim
1727+
- Some filesystem watcher error related to permissions will not be reported
17271728

17281729
vim:tw=78:ts=4:sw=4:et:ft=help:norl:

lua/nvim-tree/watcher.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,14 @@ function Event:start()
5454
local event_cb = vim.schedule_wrap(function(err, filename)
5555
if err then
5656
log.line("watcher", "event_cb '%s' '%s' FAIL : %s", self._path, filename, err)
57-
self:destroy(string.format("File system watcher failed (%s) for path %s, halting watcher.", err, self._path))
57+
local message = string.format("File system watcher failed (%s) for path %s, halting watcher.", err, self._path)
58+
if err == "EPERM" and (utils.is_windows or utils.is_wsl) then
59+
-- on directory removal windows will cascade the filesystem events out of order
60+
log.line("watcher", message)
61+
self:destroy()
62+
else
63+
self:destroy(message)
64+
end
5865
else
5966
log.line("watcher", "event_cb '%s' '%s'", self._path, filename)
6067
for _, listener in ipairs(self._listeners) do

0 commit comments

Comments
 (0)