diff options
-rw-r--r-- | src/recite.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/recite.rs b/src/recite.rs index f21a905..f75cd61 100644 --- a/src/recite.rs +++ b/src/recite.rs @@ -22,7 +22,7 @@ use std::sync::{Arc, Mutex}; /// * `Quiet` - Fork the called process into the background (`&`) /// * `And` - Run the next command only if this one succeeds (`&&`) /// * `String` - String commands together on a single line (`;`) -#[derive(Debug)] +#[derive(Debug, PartialEq, Eq)] enum Meter { None, // No meter Couplet, // Pipe the output of this command into the next @@ -376,19 +376,19 @@ impl Poem { } // Incant the verse, based on its meter - match verse.meter { + let status = match verse.meter { Meter::None => Meter::incant_none(verse, &mut out)?, Meter::Couplet => Meter::incant_couplet(verse, &mut out)?, Meter::Quiet => Meter::incant_quiet(verse, &mut out, &mut pids)?, Meter::And => Meter::incant_and(verse, &mut out)?, - Meter::String => match Meter::incant_string(verse, &mut out) { - Ok(_) => 0, - Err(e) => { - eprintln!("dwvsh: {}", e.to_string().to_lowercase()); - 1 - } - }, + Meter::String => Meter::incant_string(verse, &mut out)?, }; + + // Don't continue reciting if there was an error, unless the meter + // is String (indicating that errors should be ignored) + if verse.meter != Meter::String && status != 0 { + break; + } } // If we've successfully exited the loop, then all verse's were |