aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-10-27 15:44:33 -0400
committerJesse Luehrs <doy@tozt.net>2019-10-27 15:44:33 -0400
commit8579ee86981d7c9b960c14ef36ad4c3e17bcbeb8 (patch)
tree94930a634fff743f3c3acc6931f5a4ae62c8be49
parent3efe7c8b69df9fd146b771a6865d66dd89673334 (diff)
downloadtokio-pty-process-stream-master.tar.gz
tokio-pty-process-stream-master.zip
-rw-r--r--src/resize.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/resize.rs b/src/resize.rs
index 5b59f9e..828e128 100644
--- a/src/resize.rs
+++ b/src/resize.rs
@@ -2,6 +2,11 @@ use futures::future::Future as _;
use futures::stream::Stream as _;
use snafu::futures01::StreamExt as _;
+/// A wrapper around `Process` which listens for terminal resize signals and
+/// propagates the changes into the process running on the pty.
+///
+/// This is useful for running subprocesses in a pty that will ultimately be
+/// displayed in the user's terminal directly.
pub struct ResizingProcess<R: tokio::io::AsyncRead + 'static> {
process: crate::process::Process<R>,
resizer: Box<
@@ -13,6 +18,8 @@ pub struct ResizingProcess<R: tokio::io::AsyncRead + 'static> {
}
impl<R: tokio::io::AsyncRead + 'static> ResizingProcess<R> {
+ /// Creates a new `ResizingProcess` as a wrapper around the given
+ /// `Process` instance.
pub fn new(process: crate::process::Process<R>) -> Self {
Self {
process,
@@ -24,6 +31,8 @@ impl<R: tokio::io::AsyncRead + 'static> ResizingProcess<R> {
}
}
+ /// Returns a mutable reference to the input object provided in the inner
+ /// `Process` instance's constructor.
pub fn input(&mut self) -> &mut R {
self.process.input()
}