diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-10-27 13:33:47 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-10-27 15:37:32 -0400 |
commit | f88153f62b024d1c2ef82c5ac7ae9002e4fe2967 (patch) | |
tree | f5d9485a0e06072a22e8ae9e3a2089ee799ec948 /examples | |
parent | e74e5f1d2a1e091af214e39166b6a17d9052325c (diff) | |
download | tokio-pty-process-stream-f88153f62b024d1c2ef82c5ac7ae9002e4fe2967.tar.gz tokio-pty-process-stream-f88153f62b024d1c2ef82c5ac7ae9002e4fe2967.zip |
add terminal resizing functionality
to keep the process's pty size in sync with the size of the user's
terminal
Diffstat (limited to 'examples')
-rw-r--r-- | examples/interhack.rs | 12 | ||||
-rw-r--r-- | examples/shell.rs | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/examples/interhack.rs b/examples/interhack.rs index 2e753b5..88a3349 100644 --- a/examples/interhack.rs +++ b/examples/interhack.rs @@ -7,7 +7,7 @@ use tokio::io::AsyncRead as _; mod input; struct Interhack { - process: tokio_pty_process_stream::Process<input::buf::Stdin>, + process: tokio_pty_process_stream::ResizingProcess<input::buf::Stdin>, stdin: input::evented_stdin::Stdin, read_buf: [u8; 4096], } @@ -15,10 +15,12 @@ struct Interhack { impl Interhack { fn new() -> Self { Self { - process: tokio_pty_process_stream::Process::new( - "nethack", - &[], - input::buf::Stdin::new(), + process: tokio_pty_process_stream::ResizingProcess::new( + tokio_pty_process_stream::Process::new( + "nethack", + &[], + input::buf::Stdin::new(), + ), ), stdin: input::evented_stdin::Stdin::new(), read_buf: [0; 4096], diff --git a/examples/shell.rs b/examples/shell.rs index 682c008..2cd7ba2 100644 --- a/examples/shell.rs +++ b/examples/shell.rs @@ -15,6 +15,7 @@ fn main() { &args, input::evented_stdin::Stdin::new(), ); + let process = tokio_pty_process_stream::ResizingProcess::new(process); let _raw = crossterm::RawScreen::into_raw_mode().unwrap(); tokio::run( @@ -33,6 +34,7 @@ fn main() { tokio_pty_process_stream::Event::CommandExit { .. } => {} + tokio_pty_process_stream::Event::Resize { .. } => {} } futures::future::ok(()) }) |