aboutsummaryrefslogtreecommitdiffstats
path: root/src/pty.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-30 23:14:55 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-30 23:14:55 -0500
commit09ff545fe44242734d5f6daf4a74946d2f04728d (patch)
tree79e5b7080dd58137020748fcaf15fb089493b864 /src/pty.rs
parenta5b7f59b19052b69f3ada89e4b07c1fb6dbfaf34 (diff)
downloadpty-process-09ff545fe44242734d5f6daf4a74946d2f04728d.tar.gz
pty-process-09ff545fe44242734d5f6daf4a74946d2f04728d.zip
docs
Diffstat (limited to 'src/pty.rs')
-rw-r--r--src/pty.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/pty.rs b/src/pty.rs
index 5d398d4..1d7f113 100644
--- a/src/pty.rs
+++ b/src/pty.rs
@@ -1,9 +1,15 @@
+/// An allocated pty
pub struct Pty {
pt: async_io::Async<std::fs::File>,
pts: std::fs::File,
}
impl Pty {
+ /// Allocate and return a new pty.
+ ///
+ /// # Errors
+ /// Returns an error if the pty failed to be allocated, or if we were
+ /// unable to put it into non-blocking mode.
pub fn new() -> crate::Result<Self> {
let (pt, ptsname) = crate::sys::create_pt()?;
let pt = async_io::Async::new(pt)?;
@@ -14,6 +20,10 @@ impl Pty {
Ok(Self { pt, pts })
}
+ /// Change the terminal size associated with the pty.
+ ///
+ /// # Errors
+ /// Returns an error if we were unable to set the terminal size.
pub fn resize(&self, size: crate::Size) -> crate::Result<()> {
Ok(crate::sys::set_term_size(self, size)?)
}