diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/command.rs | 8 | ||||
-rw-r--r-- | src/pty.rs | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/command.rs b/src/command.rs index f5357d2..10de48e 100644 --- a/src/command.rs +++ b/src/command.rs @@ -4,11 +4,15 @@ use std::os::unix::io::{AsRawFd as _, FromRawFd as _}; use std::os::unix::process::CommandExt as _; pub trait Command { - fn spawn_pty(&mut self, size: Option<crate::pty::Size>) -> Result<Child>; + fn spawn_pty(&mut self, size: Option<&crate::pty::Size>) + -> Result<Child>; } impl Command for std::process::Command { - fn spawn_pty(&mut self, size: Option<crate::pty::Size>) -> Result<Child> { + fn spawn_pty( + &mut self, + size: Option<&crate::pty::Size>, + ) -> Result<Child> { let pty = crate::pty::Pty::new()?; let pts = pty.pts(size)?; @@ -34,8 +34,8 @@ impl Size { } } -impl From<Size> for nix::pty::Winsize { - fn from(size: Size) -> Self { +impl From<&Size> for nix::pty::Winsize { + fn from(size: &Size) -> Self { Self { ws_row: size.row, ws_col: size.col, @@ -78,7 +78,7 @@ impl Pty { &self.pt } - pub fn pts(&self, size: Option<Size>) -> Result<std::fs::File> { + pub fn pts(&self, size: Option<&Size>) -> Result<std::fs::File> { let fh = std::fs::OpenOptions::new() .read(true) .write(true) |