Skip to content

Commit

Permalink
Update inotify to 0.10
Browse files Browse the repository at this point in the history
See https://github.com/hannobraun/inotify-rs/blob/main/CHANGELOG.md

This requires updating the MSRV from 1.60 to 1.63.
  • Loading branch information
fornwall committed Nov 13, 2023
1 parent c4d0470 commit 6745906
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
# main branches
- main
- next
- '*'
pull_request:
release:
types: [released, prereleased]
Expand All @@ -18,7 +19,7 @@ jobs:
strategy:
matrix:
version:
- 1.60.0 # MSRV
- 1.63.0 # MSRV
- stable
- nightly
os:
Expand All @@ -38,19 +39,19 @@ jobs:
rustup override set ${{ matrix.version }}
- name: check build serde,macos_kqueue for examples
if: matrix.version != '1.60.0' && matrix.os == 'macos-latest'
if: matrix.version != '1.63.0' && matrix.os == 'macos-latest'
run: cargo check -p notify --features=serde,macos_kqueue --examples

- name: check build serde,macos_kqueue
if: matrix.version == '1.60.0' && matrix.os == 'macos-latest'
if: matrix.version == '1.63.0' && matrix.os == 'macos-latest'
run: cargo check -p notify --features=serde,macos_kqueue

- name: check build serde for examples
if: matrix.version != '1.60.0' && matrix.os != 'macos-latest'
if: matrix.version != '1.63.0' && matrix.os != 'macos-latest'
run: cargo check -p notify --features=serde --examples

- name: check build serde
if: matrix.version == '1.60.0' && matrix.os != 'macos-latest'
if: matrix.version == '1.63.0' && matrix.os != 'macos-latest'
run: cargo check --features=serde

- name: check build without crossbeam/default features
Expand Down
2 changes: 1 addition & 1 deletion notify-debouncer-full/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "notify-debouncer-full"
version = "0.3.1"
edition = "2021"
rust-version = "1.60"
rust-version = "1.63"
description = "notify event debouncer optimized for ease of use"
documentation = "https://docs.rs/notify-debouncer-full"
homepage = "https://github.com/notify-rs/notify"
Expand Down
2 changes: 1 addition & 1 deletion notify-debouncer-mini/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "notify-debouncer-mini"
version = "0.4.1"
edition = "2021"
rust-version = "1.60"
rust-version = "1.63"
description = "notify mini debouncer for events"
documentation = "https://docs.rs/notify-debouncer-mini"
homepage = "https://github.com/notify-rs/notify"
Expand Down
4 changes: 2 additions & 2 deletions notify/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "notify"
version = "6.1.1"
rust-version = "1.60"
rust-version = "1.63"
description = "Cross-platform filesystem notification library"
documentation = "https://docs.rs/notify"
homepage = "https://github.com/notify-rs/notify"
Expand All @@ -27,7 +27,7 @@ serde = { version = "1.0.89", features = ["derive"], optional = true }
walkdir = "2.2.2"

[target.'cfg(any(target_os="linux", target_os="android"))'.dependencies]
inotify = { version = "0.9", default-features = false }
inotify = { version = "0.10", default-features = false }
mio = { version = "0.8", features = ["os-ext"] }

[target.'cfg(target_os="macos")'.dependencies]
Expand Down
17 changes: 11 additions & 6 deletions notify/src/inotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,11 @@ impl EventLoop {
}
}
None => {
log::trace!("No patch for DELETE_SELF event, may be a bug?");
log::trace!(
"No patch for DELETE_SELF event, may be a bug?"
);
RemoveKind::Other
},
}
};
evs.push(
Event::new(EventKind::Remove(remove_kind))
Expand Down Expand Up @@ -430,7 +432,7 @@ impl EventLoop {
if let Some(ref mut inotify) = self.inotify {
log::trace!("adding inotify watch: {}", path.display());

match inotify.add_watch(&path, watchmask) {
match inotify.watches().add(&path, watchmask) {
Err(e) => {
Err(if e.raw_os_error() == Some(libc::ENOSPC) {
// do not report inotify limits as "no more space" on linux #266
Expand Down Expand Up @@ -462,7 +464,8 @@ impl EventLoop {
log::trace!("removing inotify watch: {}", path.display());

inotify
.rm_watch(w.clone())
.watches()
.remove(w.clone())
.map_err(|e| Error::io(e).add_path(path.clone()))?;
self.paths.remove(&w);

Expand All @@ -471,7 +474,8 @@ impl EventLoop {
for (w, p) in &self.paths {
if p.starts_with(&path) {
inotify
.rm_watch(w.clone())
.watches()
.remove(w.clone())
.map_err(|e| Error::io(e).add_path(p.into()))?;
self.watches.remove(p);
remove_list.push(w.clone());
Expand All @@ -491,7 +495,8 @@ impl EventLoop {
if let Some(ref mut inotify) = self.inotify {
for (w, p) in &self.paths {
inotify
.rm_watch(w.clone())
.watches()
.remove(w.clone())
.map_err(|e| Error::io(e).add_path(p.into()))?;
}
self.watches.clear();
Expand Down

0 comments on commit 6745906

Please sign in to comment.