diff --git a/src/cmd/chmod/mod.rs b/src/cmd/chmod/mod.rs index a476970..051e5f7 100644 --- a/src/cmd/chmod/mod.rs +++ b/src/cmd/chmod/mod.rs @@ -72,13 +72,20 @@ impl Cmd for Chmod { let action = Action { path, feedback, - quiet: matches.get_flag("quiet"), mode, }; - action.apply()?; + if let Err(e) = action.apply() { + if !matches.get_flag("quiet") { + return Err(e.into()); + } + } if matches.get_flag("recursive") { if action.path.is_dir() { - action.recurse()?; + if let Err(e) = action.recurse() { + if !matches.get_flag("quiet") { + return Err(e.into()); + } + } } } } @@ -94,7 +101,6 @@ impl Cmd for Chmod { struct Action<'a> { path: PathBuf, feedback: Option, - quiet: bool, mode: &'a str, } @@ -151,7 +157,6 @@ impl Action<'_> { Self { path: entry.path().to_path_buf(), feedback: self.feedback, - quiet: self.quiet, mode: self.mode, } }