diff options
author | Jesse Luehrs <doy@tozt.net> | 2023-12-03 02:00:32 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2023-12-03 17:25:09 -0500 |
commit | 1895e6ca5338756bb3c8879ab3f6427ee476670a (patch) | |
tree | 5e4aa37273bb3da4a516b7dde2218cc9d6466159 /tests/pipe.rs | |
parent | 1007cac2ac9c20496a5ec5a9a34b8ff84f874983 (diff) | |
download | pty-process-test.tar.gz pty-process-test.zip |
wiptest
Diffstat (limited to 'tests/pipe.rs')
-rw-r--r-- | tests/pipe.rs | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/tests/pipe.rs b/tests/pipe.rs index da2e1b0..de8c875 100644 --- a/tests/pipe.rs +++ b/tests/pipe.rs @@ -6,7 +6,10 @@ fn test_pipe_basic() { child_from.args(["1", "10"]); child_from.stdout(std::process::Stdio::from(write_fd)); - let mut child_to = std::process::Command::new("tac"); + let mut child_to = std::process::Command::new("perl"); + child_to + .arg("-nle") + .arg("unshift @a, $_; END { print for @a }"); child_to.stdin(std::process::Stdio::from(read_fd)); child_to.stdout(std::process::Stdio::piped()); @@ -33,15 +36,18 @@ fn test_pipe_blocking() { let mut pty_to = pty_process::blocking::Pty::new().unwrap(); let pts_to = pty_to.pts().unwrap(); - let mut cmd_to = pty_process::blocking::Command::new("tac"); + let mut cmd_to = pty_process::blocking::Command::new("perl"); + cmd_to + .arg("-nle") + .arg("unshift @a, $_; END { print for @a }"); cmd_to.stdin(std::process::Stdio::from(read_fd)); let mut child_to = cmd_to.spawn(&pts_to).unwrap(); assert!(child_from.wait().unwrap().success()); drop(cmd_from); - // wait for the `tac` process to finish generating output (we don't really - // have a good way to detect when that happens) + // wait for the `perl` process to finish generating output (we don't + // really have a good way to detect when that happens) std::thread::sleep(std::time::Duration::from_millis(100)); let mut buf = [0u8; 1024]; @@ -71,14 +77,17 @@ async fn test_pipe_async() { let mut pty_to = pty_process::Pty::new().unwrap(); let pts_to = pty_to.pts().unwrap(); - let mut cmd_to = pty_process::Command::new("tac"); + let mut cmd_to = pty_process::Command::new("perl"); + cmd_to + .arg("-nle") + .arg("unshift @a, $_; END { print for @a }"); cmd_to.stdin(std::process::Stdio::from(read_fd)); let mut child_to = cmd_to.spawn(&pts_to).unwrap(); assert!(child_from.wait().await.unwrap().success()); drop(cmd_from); - // wait for the `tac` process to finish generating output (we + // wait for the `perl` process to finish generating output (we // don't really have a good way to detect when that happens) tokio::time::sleep(std::time::Duration::from_millis(100)).await; |