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-20 01:20:49 +02:00
parent 6051c4693f
commit 96321f958c
2 changed files with 5 additions and 1 deletions
+4 -1
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
}
+1
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";