aboutsummaryrefslogtreecommitdiffstats
path: root/src/pty/async_io.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-14 18:11:04 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-14 18:12:21 -0500
commit38070766d15c44c3d731aa5b231e3b2ad698ac05 (patch)
tree9ea168b1ae5a6e5c0818eb058c342e79a8482c8a /src/pty/async_io.rs
parentae7718447d24ea0517e7154873c2b55fdd89538d (diff)
downloadpty-process-38070766d15c44c3d731aa5b231e3b2ad698ac05.tar.gz
pty-process-38070766d15c44c3d731aa5b231e3b2ad698ac05.zip
simplify error handling a bunch
Diffstat (limited to 'src/pty/async_io.rs')
-rw-r--r--src/pty/async_io.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/pty/async_io.rs b/src/pty/async_io.rs
index 985b2af..304f403 100644
--- a/src/pty/async_io.rs
+++ b/src/pty/async_io.rs
@@ -18,8 +18,8 @@ impl super::Pty for Pty {
// File object to take full ownership.
let pt = unsafe { std::fs::File::from_raw_fd(pt_fd) };
- let pt = async_io::Async::new(pt)
- .map_err(crate::error::Error::AsyncPty)?;
+ let pt =
+ async_io::Async::new(pt).map_err(crate::error::create_pty)?;
Ok(Self { pt, ptsname })
}
@@ -37,14 +37,12 @@ impl super::Pty for Pty {
.read(true)
.write(true)
.open(&self.ptsname)
- .map_err(|e| {
- crate::error::Error::OpenPts(e, self.ptsname.clone())
- })?;
+ .map_err(crate::error::create_pty)?;
Ok(fh)
}
fn resize(&self, size: &super::Size) -> crate::error::Result<()> {
super::set_term_size(self.pt().as_raw_fd(), size)
- .map_err(crate::error::Error::SetTermSize)
+ .map_err(crate::error::set_term_size)
}
}