use std::process::{Command, Stdio};
use waitforit::Wait;
fn main() {
Wait::new_custom(hundred_lines_or_more).condition_met();
}
fn hundred_lines_or_more() -> bool {
let stdout = match Command::new("wc")
.arg("-l")
.arg("Cargo.toml")
.stdout(Stdio::piped())
.output()
{
Ok(o) => o,
Err(_) => return false,
}
.stdout;
let stdout = String::from_utf8(stdout).expect("invalid stdout");
let lines = stdout
.split(' ')
.next()
.unwrap()
.parse::<usize>()
.expect("Parse number");
lines >= 100
}