diff options
author | Jesse Luehrs <doy@tozt.net> | 2020-07-17 00:56:00 -0400 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2020-07-17 00:57:33 -0400 |
commit | 1996a03987a5a8c7e50a16a7a63b6dbdcd0424ad (patch) | |
tree | 4ccf84e60df8e1c94166d4533a4f1e037b5b3446 /src/command.rs | |
parent | 4bfa68db838e153a1d755e4cfb5b088dfa6c4064 (diff) | |
download | pty-process-1996a03987a5a8c7e50a16a7a63b6dbdcd0424ad.tar.gz pty-process-1996a03987a5a8c7e50a16a7a63b6dbdcd0424ad.zip |
better resize api
Diffstat (limited to 'src/command.rs')
-rw-r--r-- | src/command.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/command.rs b/src/command.rs index 10de48e..cf1925d 100644 --- a/src/command.rs +++ b/src/command.rs @@ -14,7 +14,11 @@ impl Command for std::process::Command { size: Option<&crate::pty::Size>, ) -> Result<Child> { let pty = crate::pty::Pty::new()?; - let pts = pty.pts(size)?; + if let Some(size) = size { + pty.resize(size)?; + } + + let pts = pty.pts()?; let pt_fd = pty.pt().as_raw_fd(); let pts_fd = pts.as_raw_fd(); @@ -74,6 +78,10 @@ impl Child { pub fn pty(&self) -> &std::fs::File { self.pty.pt() } + + pub fn pty_resize(&self, size: &crate::pty::Size) -> Result<()> { + self.pty.resize(size) + } } impl std::ops::Deref for Child { |