Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug on windows when isHiddenFile returns an error #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

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