From 93092acaaf73df4f8a0ef264a0fb8b9b48db5d68 Mon Sep 17 00:00:00 2001 From: oech3 <79379754+oech3@users.noreply.github.com> Date: Sat, 18 Jul 2026 15:59:18 +0900 Subject: [PATCH] comm: remove overhead by .is_dir() (#13371) --- src/uu/comm/src/comm.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 395c561e10..af6d2f4646 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -329,7 +329,10 @@ fn open_file(name: &OsString, line_ending: LineEnding) -> io::Result if name == "-" { Ok(LineReader::new(Input::stdin(), line_ending)) } else { - if metadata(name)?.is_dir() { + // some platforms shows different read error + // try to override the error message, but failure of it is not serious + #[cfg(any(target_os = "wasi", target_os = "windows"))] + if metadata(name).is_ok_and(|m| m.is_dir()) { return Err(io::Error::other(translate!("comm-error-is-directory"))); } let f = File::open(name)?;