diff options
author | Jesse Luehrs <doy@tozt.net> | 2022-02-21 15:04:39 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2022-02-22 13:08:54 -0500 |
commit | 22bb1056126cee98dcf747eb48fc5fb5736fe7d7 (patch) | |
tree | f208402f7ebddfbc4c33ea952de01b39fe0c141a /src/pty.rs | |
parent | fc3a77b7fcf7da0d198c3c9ab9957c8c889a6fe0 (diff) | |
download | nix-22bb1056126cee98dcf747eb48fc5fb5736fe7d7.zip |
also implement Read and Write for &PtyMaster
Diffstat (limited to 'src/pty.rs')
-rw-r--r-- | src/pty.rs | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -95,6 +95,21 @@ impl io::Write for PtyMaster { } } +impl io::Read for &PtyMaster { + fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { + unistd::read(self.0, buf).map_err(io::Error::from) + } +} + +impl io::Write for &PtyMaster { + fn write(&mut self, buf: &[u8]) -> io::Result<usize> { + unistd::write(self.0, buf).map_err(io::Error::from) + } + fn flush(&mut self) -> io::Result<()> { + Ok(()) + } +} + /// Grant access to a slave pseudoterminal (see /// [`grantpt(3)`](https://pubs.opengroup.org/onlinepubs/9699919799/functions/grantpt.html)) /// |