tail: Fix random errors mainly on macos for piped input. Treat resolved paths to /dev/fd/0 as pipe.

Closes #3953
This commit is contained in:
Joining7943 2022-09-18 17:00:43 +02:00
parent 6051c4693f
commit 96321f958c
2 changed files with 5 additions and 1 deletions

View file

@ -75,7 +75,10 @@ impl Input {
}
InputKind::File(_) | InputKind::Stdin => {
if cfg!(unix) {
PathBuf::from(text::DEV_STDIN).canonicalize().ok()
match PathBuf::from(text::DEV_STDIN).canonicalize().ok() {
Some(path) if path != PathBuf::from(text::FD0) => Some(path),
Some(_) | None => None,
}
} else {
None
}

View file

@ -18,3 +18,4 @@ pub static BACKEND: &str = "inotify";
pub static BACKEND: &str = "kqueue";
#[cfg(target_os = "windows")]
pub static BACKEND: &str = "ReadDirectoryChanges";
pub static FD0: &str = "/dev/fd/0";