radovskyb / watcher

watcher is a Go package for watching for files or directory changes without using filesystem events.
BSD 3-Clause "New" or "Revised" License
1.47k stars 181 forks source link

FileWatcher hangs when received an Event on a File which is deleted #86

Open shivakumargowda12 opened 4 years ago

shivakumargowda12 commented 4 years ago

Hi, I have uploaded a sample go code which contains logic to handle different File Watcher events. Suppose, If I delete a File which is being watched already, the logic hangs while trying to Call Remove(path) function of watcher.go and never returns.

Requirement: To dynamically add/remove files to FileWatcher object during File Creation or Deletion inside a specific folder.

I have seen previous similar issues and workaround/solution for those issues. https://github.com/radovskyb/watcher/issues/22 https://github.com/radovskyb/watcher/issues/48

But wanted to know solution specific to my use case. Thanks FileWatcher.go.txt

shivakumargowda12 commented 4 years ago

@radovskyb , any solution to this issue. (Version: 1.0.7)