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:
parent
38afdd6ab4
commit
5121e2eec1
2 changed files with 13 additions and 2 deletions
|
@ -229,7 +229,7 @@ impl Chmoder {
|
||||||
if !self.quiet {
|
if !self.quiet {
|
||||||
show_error!("cannot operate on dangling symlink '{}'", filename);
|
show_error!("cannot operate on dangling symlink '{}'", filename);
|
||||||
}
|
}
|
||||||
} else {
|
} else if !self.quiet {
|
||||||
show_error!("cannot access '{}': No such file or directory", filename);
|
show_error!("cannot access '{}': No such file or directory", filename);
|
||||||
}
|
}
|
||||||
return Err(1);
|
return Err(1);
|
||||||
|
|
|
@ -360,13 +360,24 @@ fn test_chmod_recursive() {
|
||||||
fn test_chmod_non_existing_file() {
|
fn test_chmod_non_existing_file() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
.arg("-R")
|
.arg("-R")
|
||||||
.arg("--verbose")
|
|
||||||
.arg("-r,a+w")
|
.arg("-r,a+w")
|
||||||
.arg("does-not-exist")
|
.arg("does-not-exist")
|
||||||
.fails()
|
.fails()
|
||||||
.stderr_contains(&"cannot access 'does-not-exist': No such file or directory");
|
.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]
|
#[test]
|
||||||
fn test_chmod_preserve_root() {
|
fn test_chmod_preserve_root() {
|
||||||
new_ucmd!()
|
new_ucmd!()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue