mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
tail: switch from Notify 5.0.0-pre.13 to 5.0.0-pre.14
This commit is contained in:
parent
18a06c310e
commit
a9fa94824d
4 changed files with 47 additions and 41 deletions
30
Cargo.lock
generated
30
Cargo.lock
generated
|
@ -582,7 +582,7 @@ dependencies = [
|
|||
"bitflags",
|
||||
"crossterm_winapi",
|
||||
"libc",
|
||||
"mio",
|
||||
"mio 0.7.7",
|
||||
"parking_lot",
|
||||
"signal-hook",
|
||||
"signal-hook-mio",
|
||||
|
@ -1144,6 +1144,20 @@ dependencies = [
|
|||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"miow",
|
||||
"ntapi",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.3.7"
|
||||
|
@ -1210,9 +1224,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "notify"
|
||||
version = "5.0.0-pre.13"
|
||||
version = "5.0.0-pre.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "245d358380e2352c2d020e8ee62baac09b3420f1f6c012a31326cfced4ad487d"
|
||||
checksum = "d13c22db70a63592e098fb51735bab36646821e6389a0ba171f3549facdf0b74"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"crossbeam-channel",
|
||||
|
@ -1221,7 +1235,7 @@ dependencies = [
|
|||
"inotify",
|
||||
"kqueue",
|
||||
"libc",
|
||||
"mio",
|
||||
"mio 0.8.2",
|
||||
"walkdir",
|
||||
"winapi 0.3.9",
|
||||
]
|
||||
|
@ -1905,7 +1919,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "29fd5867f1c4f2c5be079aee7a2adf1152ebb04a4bc4d341f504b7dece607ed4"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"mio",
|
||||
"mio 0.7.7",
|
||||
"signal-hook",
|
||||
]
|
||||
|
||||
|
@ -3391,6 +3405,12 @@ version = "0.10.2+wasi-snapshot-preview1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.11.0+wasi-snapshot-preview1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||
|
||||
[[package]]
|
||||
name = "which"
|
||||
version = "3.1.1"
|
||||
|
|
|
@ -17,7 +17,7 @@ path = "src/tail.rs"
|
|||
|
||||
[dependencies]
|
||||
clap = { version = "2.33", features = ["wrap_help"] }
|
||||
notify = { version = "5.0.0-pre.13", features=["macos_kqueue"]}
|
||||
notify = { version = "5.0.0-pre.14", features=["macos_kqueue"]}
|
||||
libc = "0.2.42"
|
||||
uucore = { version=">=0.0.10", package="uucore", path="../../uucore", features=["ringbuffer"] }
|
||||
uucore_procs = { version=">=0.0.7", package="uucore_procs", path="../../uucore_procs" }
|
||||
|
|
|
@ -27,7 +27,7 @@ mod platform;
|
|||
use chunks::ReverseChunks;
|
||||
|
||||
use clap::{App, Arg};
|
||||
use notify::{RecursiveMode, Watcher};
|
||||
use notify::{RecommendedWatcher, RecursiveMode, Watcher, WatcherKind};
|
||||
use std::collections::HashMap;
|
||||
use std::collections::VecDeque;
|
||||
use std::fmt;
|
||||
|
@ -488,44 +488,29 @@ pub fn uu_app() -> App<'static, 'static> {
|
|||
fn follow(files: &mut FileHandling, settings: &Settings) {
|
||||
let mut process = platform::ProcessChecker::new(settings.pid);
|
||||
|
||||
use std::sync::{Arc, Mutex};
|
||||
let (tx, rx) = channel();
|
||||
|
||||
let mut watcher: Box<dyn Watcher>;
|
||||
if settings.use_polling {
|
||||
// Polling based Watcher implementation
|
||||
watcher = Box::new(
|
||||
// TODO: [2021-09; jhscheer] remove arc/mutex if upstream merges:
|
||||
// https://github.com/notify-rs/notify/pull/360
|
||||
notify::PollWatcher::with_delay(Arc::new(Mutex::new(tx)), settings.sleep_sec).unwrap(),
|
||||
);
|
||||
} else {
|
||||
// Watcher is implemented per platform using the best implementation available on that
|
||||
// platform. In addition to such event driven implementations, a polling implementation
|
||||
// is also provided that should work on any platform.
|
||||
// Linux / Android: inotify
|
||||
// macOS: FSEvents / kqueue
|
||||
// Windows: ReadDirectoryChangesWatcher
|
||||
// FreeBSD / NetBSD / OpenBSD / DragonflyBSD: kqueue
|
||||
// Fallback: polling (default delay is 30 seconds!)
|
||||
// Watcher is implemented per platform using the best implementation available on that
|
||||
// platform. In addition to such event driven implementations, a polling implementation
|
||||
// is also provided that should work on any platform.
|
||||
// Linux / Android: inotify
|
||||
// macOS: FSEvents / kqueue
|
||||
// Windows: ReadDirectoryChangesWatcher
|
||||
// FreeBSD / NetBSD / OpenBSD / DragonflyBSD: kqueue
|
||||
// Fallback: polling (default delay is 30 seconds!)
|
||||
|
||||
// NOTE: On macOS only `kqueue` is suitable for our use case since `FSEvents` waits until
|
||||
// file close to delivers modify events. See:
|
||||
// https://github.com/notify-rs/notify/issues/240
|
||||
// NOTE:
|
||||
// We force the use of kqueue with: features=["macos_kqueue"],
|
||||
// because macOS only `kqueue` is suitable for our use case since `FSEvents` waits until
|
||||
// file close util it delivers a modify event. See:
|
||||
// https://github.com/notify-rs/notify/issues/240
|
||||
|
||||
// TODO: [2021-09; jhscheer] change to RecommendedWatcher if upstream merges:
|
||||
// https://github.com/notify-rs/notify/pull/362
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
watcher = Box::new(notify::kqueue::KqueueWatcher::new(tx).unwrap());
|
||||
}
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
watcher = Box::new(notify::RecommendedWatcher::new(tx).unwrap());
|
||||
}
|
||||
// TODO: [2021-09; jhscheer] adjust `delay` if upstream merges:
|
||||
// https://github.com/notify-rs/notify/pull/364
|
||||
};
|
||||
let mut watcher: Box<dyn Watcher> =
|
||||
if settings.use_polling || RecommendedWatcher::kind() == WatcherKind::PollWatcher {
|
||||
Box::new(notify::PollWatcher::with_delay(tx, settings.sleep_sec).unwrap())
|
||||
} else {
|
||||
Box::new(notify::RecommendedWatcher::new(tx).unwrap())
|
||||
};
|
||||
|
||||
// Iterate user provided `paths`.
|
||||
// Add existing files to `Watcher` (InotifyWatcher).
|
||||
|
|
|
@ -27,6 +27,7 @@ static FOOBAR_2_TXT: &str = "foobar2.txt";
|
|||
static FOOBAR_WITH_NULL_TXT: &str = "foobar_with_null.txt";
|
||||
static FOLLOW_NAME_TXT: &str = "follow_name.txt";
|
||||
static FOLLOW_NAME_SHORT_EXP: &str = "follow_name_short.expected";
|
||||
#[cfg(target_os = "linux")]
|
||||
static FOLLOW_NAME_EXP: &str = "follow_name.expected";
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Reference in a new issue