Skip to content

Conversation

anthonyraymond
Copy link

On windows when the isHiddenFile() methods returns an error it is of type os.Errno.

At another location on the code there is this particular piece of code:

list, err = w.list(name)
if err != nil {
	if os.IsNotExist(err) {
		w.mu.Unlock()
		if name == err.(*os.PathError).Path {
			w.Error <- ErrWatchedFileDeleted
			w.Remove(name)
		}
		w.mu.Lock()
	} else {
		w.Error <- err
	}
}

where list() uses isHiddenFile.

The problem is that os.IsNotExist(err) returns true for os.Errno but fails to cast to os.PathError which results in weird lock state because of the panic.

xiaoyang-chen pushed a commit to xiaoyang-chen/file-watcher that referenced this pull request Aug 14, 2025
…ix a bug on windows when isHiddenFile returns an error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant