diff --git a/src/uu/tail/src/paths.rs b/src/uu/tail/src/paths.rs index 0ebb265b2a6..203a23817e7 100644 --- a/src/uu/tail/src/paths.rs +++ b/src/uu/tail/src/paths.rs @@ -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 } diff --git a/src/uu/tail/src/text.rs b/src/uu/tail/src/text.rs index fba3968dd12..62ad9cf707c 100644 --- a/src/uu/tail/src/text.rs +++ b/src/uu/tail/src/text.rs @@ -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";