From b903788696c9f2b8ea54594fc4e0ed48df273220 Mon Sep 17 00:00:00 2001 From: pjht Date: Sun, 22 Sep 2024 13:57:04 -0500 Subject: [PATCH] Pass PTY slave as test program stdio --- src/main.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ab3a32d..81ff75f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -68,7 +68,14 @@ fn main() { let mut pty = File::open("/dev/ptmx").unwrap(); - Command::new("/bin/pts_tester").spawn().unwrap(); + let pts = File::open("/dev/pts0").unwrap(); + + Command::new("/bin/pts_tester") + .stdin(pts.try_clone().unwrap()) + .stdout(pts.try_clone().unwrap()) + .stderr(pts) + .spawn() + .unwrap(); let mut kbd_buf = [0u8; 512]; let mut pty_buf = [0u8; 512];