~autumnull/flatiron

0144ead03b12a01d5e4c2b86f8ba76b63b31950e — Autumn! 2 years ago de66a05
Fixed broken pipe error
2 files changed, 10 insertions(+), 3 deletions(-)

M Cargo.lock
M src/main.rs
M Cargo.lock => Cargo.lock +1 -1
@@ 4,7 4,7 @@ version = 3

[[package]]
name = "flatiron"
version = "1.0.2"
version = "1.0.4"
dependencies = [
 "nom",
]

M src/main.rs => src/main.rs +9 -2
@@ 1,5 1,5 @@
use flatiron::convert;
use std::io::Read;
use std::io::{Read, Write};

fn main() {
    let mut textile = String::new();


@@ 8,5 8,12 @@ fn main() {
        eprintln!("Something went wrong while reading stdin.")
    }
    let html = convert(textile);
    print!("{}", html);
    let mut stdout = std::io::stdout();

    let res = write!(stdout, "{}", html);
    if let Err(ref e) = res {
        if e.kind() != std::io::ErrorKind::BrokenPipe {
            res.unwrap();
        }
    }
}