1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #5916 from cakebaker/du_non_existing

du: adapt error message to match GNU's
This commit is contained in:
Sylvestre Ledru 2024-01-30 17:13:37 +01:00 committed by GitHub
commit 8691ec9a80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 5 deletions

View file

@ -785,8 +785,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
.send(Err(USimpleError::new( .send(Err(USimpleError::new(
1, 1,
format!( format!(
"{}: No such file or directory", "cannot access {}: No such file or directory",
path.to_string_lossy().maybe_quote() path.to_string_lossy().quote()
), ),
))) )))
.map_err(|e| USimpleError::new(1, e.to_string()))?; .map_err(|e| USimpleError::new(1, e.to_string()))?;

View file

@ -173,11 +173,15 @@ fn test_du_with_posixly_correct() {
} }
#[test] #[test]
fn test_du_basics_bad_name() { fn test_du_non_existing_files() {
new_ucmd!() new_ucmd!()
.arg("bad_name") .arg("non_existing_a")
.arg("non_existing_b")
.fails() .fails()
.stderr_only("du: bad_name: No such file or directory\n"); .stderr_only(concat!(
"du: cannot access 'non_existing_a': No such file or directory\n",
"du: cannot access 'non_existing_b': No such file or directory\n"
));
} }
#[test] #[test]