1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

pty: tweak EIO matching for Rust 1.55 and up

The release notes suggest never matching ErrorKind::Other,
so let's avoid that.
This commit is contained in:
Wez Furlong 2021-09-09 09:16:34 -07:00
parent c870c73dbe
commit 1f97a8324e

View File

@ -84,9 +84,7 @@ impl std::ops::DerefMut for PtyFd {
impl Read for PtyFd {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, io::Error> {
match self.0.read(buf) {
Err(ref e)
if e.kind() == io::ErrorKind::Other && e.raw_os_error() == Some(libc::EIO) =>
{
Err(ref e) if e.raw_os_error() == Some(libc::EIO) => {
// EIO indicates that the slave pty has been closed.
// Treat this as EOF so that std::io::Read::read_to_string
// and similar functions gracefully terminate when they