Skip to content

Commit

Permalink
Merge pull request #20 from emilio/interrupt
Browse files Browse the repository at this point in the history
Handle EINTR.
  • Loading branch information
alexcrichton committed Jan 13, 2020
2 parents b7d8bc9 + b6c1e95 commit 655977e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,11 @@ mod imp {
loop {
fd.revents = 0;
if libc::poll(&mut fd, 1, -1) == -1 {
return Err(io::Error::last_os_error());
let e = io::Error::last_os_error();
match e.kind() {
io::ErrorKind::Interrupted => continue,
_ => return Err(e),
}
}
if fd.revents == 0 {
continue;
Expand All @@ -605,8 +609,10 @@ mod imp {
"early EOF on jobserver pipe",
))
}
Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => {}
Err(e) => return Err(e),
Err(e) => match e.kind() {
io::ErrorKind::WouldBlock | io::ErrorKind::Interrupted => continue,
_ => return Err(e),
},
}
}
}
Expand Down

0 comments on commit 655977e

Please sign in to comment.