Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
doy committed Dec 3, 2023
1 parent d7aff2a commit cf8b0a1
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions tests/winch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ fn test_winch_std() {
use std::io::Write as _;

let mut pty = pty_process::blocking::Pty::new().unwrap();
let pts = pty.pts().unwrap();
pty.resize(pty_process::Size::new(24, 80)).unwrap();
let mut child = pty_process::blocking::Command::new("perl")
.args([
"-E",
"$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>",
])
.spawn(&pts)
.unwrap();
let mut child = {
let pts = pty.pts().unwrap();
pty.resize(pty_process::Size::new(24, 80)).unwrap();
pty_process::blocking::Command::new("perl")
.args([
"-E",
"$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>",
])
.spawn(&pts)
.unwrap()
};

let mut output = helpers::output(&pty);
assert_eq!(output.next().unwrap(), "started\r\n");
Expand All @@ -33,15 +35,17 @@ async fn test_winch_async() {
use tokio::io::AsyncWriteExt as _;

let mut pty = pty_process::Pty::new().unwrap();
let pts = pty.pts().unwrap();
pty.resize(pty_process::Size::new(24, 80)).unwrap();
let mut child = pty_process::Command::new("perl")
.args(&[
"-E",
"$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>",
])
.spawn(&pts)
.unwrap();
let mut child = {
let pts = pty.pts().unwrap();
pty.resize(pty_process::Size::new(24, 80)).unwrap();
pty_process::Command::new("perl")
.args([
"-E",
"$|++; $SIG{WINCH} = sub { say 'WINCH' }; say 'started'; <>",
])
.spawn(&pts)
.unwrap()
};

let (pty_r, mut pty_w) = pty.split();
let mut output = helpers::output_async(pty_r);
Expand Down

0 comments on commit cf8b0a1

Please sign in to comment.