Merge pull request #3823 from niyaznigmatullin/update-notify-5.0.0-pre.16

Update notify 5.0.0 pre.16
This commit is contained in:
Sylvestre Ledru 2022-08-15 21:44:09 +02:00 committed by GitHub
commit 68aec6685e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 11 deletions

4
Cargo.lock generated
View file

@ -1201,9 +1201,9 @@ dependencies = [
[[package]]
name = "notify"
version = "5.0.0-pre.15"
version = "5.0.0-pre.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "553f9844ad0b0824605c20fb55a661679782680410abfb1a8144c2e7e437e7a7"
checksum = "530f6314d6904508082f4ea424a0275cf62d341e118b313663f266429cb19693"
dependencies = [
"bitflags",
"crossbeam-channel",

View file

@ -18,7 +18,7 @@ path = "src/tail.rs"
[dependencies]
clap = { version = "3.2", features = ["wrap_help", "cargo"] }
libc = "0.2.126"
notify = { version = "=5.0.0-pre.15", features=["macos_kqueue"]}
notify = { version = "=5.0.0-pre.16", features=["macos_kqueue"]}
uucore = { version=">=0.0.11", package="uucore", path="../../uucore", features=["ringbuffer", "lines"] }
[target.'cfg(windows)'.dependencies]

View file

@ -853,21 +853,20 @@ fn start_watcher_thread(settings: &mut Settings) -> Result<WatcherRx, Box<(dyn U
*/
let watcher: Box<dyn Watcher>;
let watcher_config = notify::poll::PollWatcherConfig {
poll_interval: settings.sleep_sec,
let watcher_config = notify::Config::default()
.with_poll_interval(settings.sleep_sec)
/*
NOTE: By enabling compare_contents, performance will be significantly impacted
as all files will need to be read and hashed at each `poll_interval`.
However, this is necessary to pass: "gnu/tests/tail-2/F-vs-rename.sh"
*/
compare_contents: true,
};
.with_compare_contents(true);
if settings.use_polling || RecommendedWatcher::kind() == WatcherKind::PollWatcher {
settings.use_polling = true; // We have to use polling because there's no supported backend
watcher = Box::new(notify::PollWatcher::with_config(tx, watcher_config).unwrap());
watcher = Box::new(notify::PollWatcher::new(tx, watcher_config).unwrap());
} else {
let tx_clone = tx.clone();
match notify::RecommendedWatcher::new(tx) {
match notify::RecommendedWatcher::new(tx, notify::Config::default()) {
Ok(w) => watcher = Box::new(w),
Err(e) if e.to_string().starts_with("Too many open files") => {
/*
@ -882,8 +881,7 @@ fn start_watcher_thread(settings: &mut Settings) -> Result<WatcherRx, Box<(dyn U
);
set_exit_code(1);
settings.use_polling = true;
watcher =
Box::new(notify::PollWatcher::with_config(tx_clone, watcher_config).unwrap());
watcher = Box::new(notify::PollWatcher::new(tx_clone, watcher_config).unwrap());
}
Err(e) => return Err(USimpleError::new(1, e.to_string())),
};