Given
use nix::sys::termios::{
cfgetospeed, tcgetattr
};
fn main() {
let stdin = std::io::stdin();
let termios = tcgetattr(stdin).expect("Could not get terminal attributes");
let speed = cfgetospeed(&termios);
println!("{:?}", speed);
}
We receive:
> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/demo`
thread 'main' panicked at /home/jak/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/nix-0.30.1/src/sys/termios.rs:767:70:
called `Result::unwrap()` on an `Err` value: EINVAL
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
with glibc 2.42
(Minimized reproducer of uutils/coreutils#8474)