Skip to content

Commit de81af5

Browse files
committed
src/io/mod.rs: don't raise an error on close if it was a directory
1 parent e933877 commit de81af5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/io/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,16 @@ impl InputHandle {
151151
let mut buf: [u8; BUFSIZE] = [0; BUFSIZE];
152152

153153
loop {
154-
let n = self.inner.read(&mut buf[..])?;
154+
let n = match self.inner.read(&mut buf[..]) {
155+
Ok(n) => n,
156+
157+
// There are times when the engine tries to open and read
158+
// directories. When closing out such a handle, we'll get this
159+
// error, but we should ignore it.
160+
Err(ref ioe) if ioe.raw_os_error() == Some(libc::EISDIR) => return Ok(()),
161+
162+
Err(e) => return Err(e.into()),
163+
};
155164

156165
if n == 0 {
157166
break;

0 commit comments

Comments
 (0)