diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 569c94d96..512eb6a8a 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -471,11 +471,18 @@ impl Stater { } fn new(matches: &ArgMatches) -> UResult { - let files: Vec = matches + let mut files: Vec = matches .values_of(ARG_FILES) .map(|v| v.map(ToString::to_string).collect()) .unwrap_or_default(); - + #[cfg(unix)] + if files.contains(&String::from("-")) { + files = Vec::from([Path::new("/dev/stdin") + .canonicalize()? + .into_os_string() + .into_string() + .unwrap()]); + } let format_str = if matches.is_present(options::PRINTF) { matches .value_of(options::PRINTF)