mirror of
https://github.com/uutils/coreutils.git
synced 2026-07-25 21:21:07 -04:00
comm: remove overhead by .is_dir() (#13371)
This commit is contained in:
@@ -329,7 +329,10 @@ fn open_file(name: &OsString, line_ending: LineEnding) -> io::Result<LineReader>
|
||||
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)?;
|
||||
|
||||
Reference in New Issue
Block a user