diff --git a/src/uu/cat/src/cat.rs b/src/uu/cat/src/cat.rs index babb0ce925e..5b35db012d5 100644 --- a/src/uu/cat/src/cat.rs +++ b/src/uu/cat/src/cat.rs @@ -19,7 +19,7 @@ use std::os::fd::AsFd; use std::os::unix::fs::FileTypeExt; use thiserror::Error; use uucore::display::Quotable; -use uucore::error::UResult; +use uucore::error::{UResult, strip_errno}; use uucore::translate; use uucore::{fast_inc::fast_inc_one, format_usage}; @@ -82,7 +82,7 @@ impl LineNumber { #[derive(Error, Debug)] enum CatError { /// Wrapper around `io::Error` - #[error("{0}")] + #[error("{}", strip_errno(.0))] Io(#[from] io::Error), /// Wrapper around `nix::Error` #[cfg(any(target_os = "linux", target_os = "android"))] diff --git a/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected b/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected index 04a2d4be8a4..f9fcb287b55 100644 --- a/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected +++ b/tests/fixtures/cat/three_directories_and_file_and_stdin.stderr.expected @@ -1,5 +1,5 @@ cat: test_directory3/test_directory4: Is a directory -cat: file_which_does_not_exist.txt: No such file or directory (os error 2) +cat: file_which_does_not_exist.txt: No such file or directory cat: test_directory3/test_directory5: Is a directory cat: test_directory3/../test_directory3/test_directory5: Is a directory cat: test_directory3: Is a directory