1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

chmod: add check for quiet

This commit is contained in:
Michael Debertol 2021-08-17 17:02:15 +02:00
parent 38afdd6ab4
commit 5121e2eec1
2 changed files with 13 additions and 2 deletions

View file

@ -229,7 +229,7 @@ impl Chmoder {
if !self.quiet {
show_error!("cannot operate on dangling symlink '{}'", filename);
}
} else {
} else if !self.quiet {
show_error!("cannot access '{}': No such file or directory", filename);
}
return Err(1);

View file

@ -360,13 +360,24 @@ fn test_chmod_recursive() {
fn test_chmod_non_existing_file() {
new_ucmd!()
.arg("-R")
.arg("--verbose")
.arg("-r,a+w")
.arg("does-not-exist")
.fails()
.stderr_contains(&"cannot access 'does-not-exist': No such file or directory");
}
#[test]
fn test_chmod_non_existing_file_silent() {
new_ucmd!()
.arg("-R")
.arg("--quiet")
.arg("-r,a+w")
.arg("does-not-exist")
.fails()
.no_stderr()
.code_is(1);
}
#[test]
fn test_chmod_preserve_root() {
new_ucmd!()