diff --git a/CHANGELOG.md b/CHANGELOG.md index 17c96504..165b2455 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ ## unreleased +- FIX: Handle interrupted system call errors from mio [#281] + +[#281]: https://github.com/notify-rs/notify/pull/281 ## 5.0.0-pre.5 (2020-01-28) diff --git a/src/inotify.rs b/src/inotify.rs index e9e66e6b..95bcae96 100644 --- a/src/inotify.rs +++ b/src/inotify.rs @@ -131,7 +131,14 @@ impl EventLoop { let mut events = mio::Events::with_capacity(16); loop { // Wait for something to happen. - self.poll.poll(&mut events, None).expect("poll failed"); + match self.poll.poll(&mut events, None) { + Err(ref e) if matches!(e.kind(), std::io::ErrorKind::Interrupted) => { + // System call was interrupted, we will retry + // TODO: Not covered by tests (to reproduce likely need to setup signal handlers) + }, + Err(e) => panic!("poll failed: {}", e), + Ok(()) => {} + } // Process whatever happened. for event in &events {