diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/rope.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/rope.rs b/src/rope.rs index b5b5f36..485de7f 100644 --- a/src/rope.rs +++ b/src/rope.rs @@ -1,4 +1,4 @@ -use std::io::{Read, Write}; +use std::io::{ErrorKind, Read, Write}; use std::rc::Rc; const MAX_NODE_SIZE: usize = 1024; @@ -214,7 +214,15 @@ impl Rope { let mut buf = vec![0; MAX_NODE_SIZE]; let mut rope = Rope::empty(); loop { - let n = r.read(&mut buf)?; + let n = match r.read(&mut buf) { + Ok(n) => n, + Err(err) => { + if err.kind() == ErrorKind::Interrupted { + continue; + } + return Err(err); + } + }; if n == 0 { break; } |
