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

Handle interrupted error from mio #281

Merged
merged 2 commits into from
Feb 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 8 additions & 1 deletion src/inotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
rschoon marked this conversation as resolved.
Show resolved Hide resolved
// 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 {
Expand Down