rjeczalik / notify

File system event notification library on steroids.
MIT License
902 stars 128 forks source link

kqueue: Don't panic when an error occurs on init (fixes #149) #151

Closed imsodin closed 6 years ago

imsodin commented 6 years ago

Instead of panicking, return a stub watcher that returns a sensible error message like the "not implemented" one does.

Another approach was implemented by @calmh, in that the watcher isn't initialized initially but only on first use and the initialization function recovers from panics: https://github.com/syncthing/notify/commit/2556ab349002cb2f9c250783c06b1976fc7d23b4

calmh commented 6 years ago

This is cleaner than my hack.

imsodin commented 6 years ago

@rjeczalik @pblaszczyk Did you already get a chance to look at this?

ppknap commented 6 years ago

@rjeczalik these changes LGTM. Could you review them and merge if OK? AFAIK @pblaszczyk won't be able to review this in the short term...

rjeczalik commented 6 years ago

Thanks @imsodin for the fix 😃