-
Notifications
You must be signed in to change notification settings - Fork 249
Closed
Description
Current State
If :INotify::Notifier.new
(or #watch
) were to raise Errno::ENOSPC
, the linux driver would abort
the containing process:
def _configure(directory, &callback)
require 'rb-inotify'
@worker ||= ::INotify::Notifier.new
@worker.watch(directory.to_s, *options.events, &callback)
rescue Errno::ENOSPC
abort(INOTIFY_LIMIT_MESSAGE)
end
Calling abort
from a gem is never appropriate.
Desired State
Errno::ENOSPC
should be wrapped by raising a named exception (with ENOSPC
as the cause). That will raise out of the public interface start
. The calling code in the containing process can then take the appropriate action, by rescuing that specific exception or a catch-all base class.
Steps to Reproduce
I didn't try, but you'd need to run out the count of inotify
file descriptors. Then call listener.start
. That would cause the containing process to abruptly abort
.