mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
chmod: add check for quiet
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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!()
|
||||
|
||||
Reference in New Issue
Block a user