From 4844301a084a537fcb6f789cd65bd4bb52c6870e Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 22 Sep 2024 13:57:56 -0500 Subject: [PATCH] Use stdio instead of opening the slave manually --- src/main.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index a5d16f5..23e70c6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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); } }