diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-12-28 03:33:52 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-12-28 05:28:28 -0500 |
commit | f8780ca1e76286688b74d8a6c64d5fadf3cfd2a1 (patch) | |
tree | b1e0fe6a378f3a8810e0332ca572a86185fd556c /tests/winch.rs | |
parent | b181b63a69d5db78769c1c3723a9940f66491466 (diff) | |
download | pty-process-f8780ca1e76286688b74d8a6c64d5fadf3cfd2a1.tar.gz pty-process-f8780ca1e76286688b74d8a6c64d5fadf3cfd2a1.zip |
wip
Diffstat (limited to 'tests/winch.rs')
-rw-r--r-- | tests/winch.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/winch.rs b/tests/winch.rs index 234afeb..326efcc 100644 --- a/tests/winch.rs +++ b/tests/winch.rs @@ -1,22 +1,22 @@ -use pty_process::Command as _; use std::io::{Read as _, Write as _}; #[cfg(feature = "backend-std")] #[test] fn test_winch() { - let mut child = std::process::Command::new("perl") - .args(&[ - "-E", - "$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>", - ]) - .spawn_pty(Some(&pty_process::Size::new(24, 80))) - .unwrap(); + let pty = pty_process::std::Pty::new().unwrap(); + pty.resize(pty_process::Size::new(24, 80)).unwrap(); + let mut cmd = pty_process::std::Command::new("perl"); + cmd.args(&[ + "-E", + "$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>", + ]); + let mut child = cmd.spawn(pty).unwrap(); let mut buf = [0u8; 1024]; let bytes = child.pty().read(&mut buf).unwrap(); assert_eq!(&buf[..bytes], b"started\r\n"); - child.resize_pty(&pty_process::Size::new(25, 80)).unwrap(); + child.resize_pty(pty_process::Size::new(25, 80)).unwrap(); let bytes = child.pty().read(&mut buf).unwrap(); assert_eq!(&buf[..bytes], b"WINCH\r\n"); |