Fix a bug with status_checked_with_codes (#202)

This commit is contained in:
Rebecca Turner
2022-11-19 01:28:15 -05:00
committed by Thomas Schönauer
parent c4091584c3
commit 582bc737cb

View File

@@ -179,15 +179,12 @@ impl Executor {
#[cfg_attr(windows, allow(dead_code))] #[cfg_attr(windows, allow(dead_code))]
pub fn status_checked_with_codes(&mut self, codes: &[i32]) -> Result<()> { pub fn status_checked_with_codes(&mut self, codes: &[i32]) -> Result<()> {
match self { match self {
Executor::Wet(c) => c.status_checked_with(|status| match status.code() { Executor::Wet(c) => c.status_checked_with(|status| {
Some(code) => { if status.success() || status.code().as_ref().map(|c| codes.contains(c)).unwrap_or(false) {
if codes.contains(&code) { Ok(())
Ok(()) } else {
} else { Err(())
Err(())
}
} }
None => Err(()),
}), }),
Executor::Dry(c) => { Executor::Dry(c) => {
c.dry_run(); c.dry_run();