fn compare_with_tput() {
    use std::process::Command;
    use std::process::Stdio;

    let cols_output = Command::new("tput")
        .arg("cols")
        .stderr(Stdio::inherit())
        .output()
        .unwrap();
    let rows_output = Command::new("tput")
        .arg("lines")
        .stderr(Stdio::inherit())
        .output()
        .unwrap();
    assert!(cols_output.status.success());
    assert!(rows_output.status.success());

    let cols = String::from_utf8(cols_output.stdout).unwrap()
        .trim()
        .parse::<u16>()
        .unwrap();
    let rows = String::from_utf8(rows_output.stdout).unwrap()
        .trim()
        .parse::<u16>()
        .unwrap();

    println!("{} {}", rows, cols);

    if let Some((Width(w), Height(h))) = terminal_size() {
        assert_eq!(rows, h);
        assert_eq!(cols, w);
    }
}
/// Compare result with the output of `tput cols` and `tput lines`
Compare result with the output of `tput cols` and `tput lines`
Compare result with the output of ` tput cols ` and ` tput lines `
fn compare_with_tput() {
    use std::process::Command;
    use std::process::Stdio;
    let cols_output = Command::new("tput")
        .arg("cols")
        .stderr(Stdio::inherit())
        .output()
        .unwrap();
    let rows_output = Command::new("tput")
        .arg("lines")
        .stderr(Stdio::inherit())
        .output()
        .unwrap();
    assert!(cols_output.status.success());
    assert!(rows_output.status.success());
    let cols = String::from_utf8(cols_output.stdout).unwrap()
        .trim()
        .parse::<u16>()
        .unwrap();
    let rows = String::from_utf8(rows_output.stdout).unwrap()
        .trim()
        .parse::<u16>()
        .unwrap();
    println!("{} {}", rows, cols);
    if let Some((Width(w), Height(h))) = terminal_size() {
        assert_eq!(rows, h);
        assert_eq!(cols, w);
    }
}
fn compare_with_tput ( ) { use std :: process :: Command ; use std :: process :: Stdio ; let cols_output = Command :: new ( " " ) . arg ( " " ) . stderr ( Stdio :: inherit ( ) ) . output ( ) . unwrap ( ) ; let rows_output = Command :: new ( " " ) . arg ( " " ) . stderr ( Stdio :: inherit ( ) ) . output ( ) . unwrap ( ) ; assert ! ( cols_output status success ( ) ) ; assert ! ( rows_output status success ( ) ) ; let cols = String :: from_utf8 ( cols_output . stdout ) . unwrap ( ) . trim ( ) . parse :: < u16 > ( ) . unwrap ( ) ; let rows = String :: from_utf8 ( rows_output . stdout ) . unwrap ( ) . trim ( ) . parse :: < u16 > ( ) . unwrap ( ) ; println ! ( " " rows cols ) ; if let Some ( ( Width ( w ) , Height ( h ) ) ) = terminal_size ( ) { assert_eq ! ( rows h ) ; assert_eq ! ( cols w ) ; } }
Compare result with the output of `tput cols` and `tput lines`
Compare result with the output of ` tput cols ` and ` tput lines `