Use stdio instead of opening the slave manually

This commit is contained in:
pjht 2024-09-22 13:57:56 -05:00
parent feac63c100
commit 4844301a08
Signed by: pjht
GPG Key ID: 7B5F6AFBEC7EE78E

View File

@ -1,12 +1,8 @@
use std::{fs::File, io::{BufRead, BufReader}};
use std::io::Write;
use std::io;
fn main() {
let pts_read = File::open("/dev/pts0").unwrap();
let mut pts_write = File::open("/dev/pts0").unwrap();
for line in BufReader::new(pts_read).lines() {
for line in io::stdin().lines() {
let line = line.unwrap();
writeln!(pts_write, "Got line on PTS: {:?}", line).unwrap();
println!("Got line on PTS: {:?}", line);
}
}