aboutsummaryrefslogtreecommitdiffstats
path: root/src/pty/std.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pty/std.rs')
-rw-r--r--src/pty/std.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/pty/std.rs b/src/pty/std.rs
index 84097f9..a68e3fc 100644
--- a/src/pty/std.rs
+++ b/src/pty/std.rs
@@ -1,6 +1,6 @@
use crate::error::*;
-use std::os::unix::io::FromRawFd as _;
+use std::os::unix::io::{AsRawFd as _, FromRawFd as _};
pub struct Pty {
pt: std::fs::File,
@@ -8,6 +8,8 @@ pub struct Pty {
}
impl super::Pty for Pty {
+ type Pt = std::fs::File;
+
fn new() -> Result<Self> {
let (pt_fd, ptsname) = super::create_pt()?;
@@ -21,7 +23,7 @@ impl super::Pty for Pty {
Ok(Self { pt, ptsname })
}
- fn pt(&self) -> &std::fs::File {
+ fn pt(&self) -> &Self::Pt {
&self.pt
}
@@ -33,4 +35,9 @@ impl super::Pty for Pty {
.map_err(|e| Error::OpenPts(self.ptsname.clone(), e))?;
Ok(fh)
}
+
+ fn resize(&self, size: &super::Size) -> Result<()> {
+ super::set_term_size(self.pt().as_raw_fd(), size)
+ .map_err(Error::SetTermSize)
+ }
}