Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interrupted syscall panic in use-dev-tty #762

Merged
merged 1 commit into from
Feb 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/event/source/unix/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,20 @@ impl EventSource for UnixInternalEventSource {
return Ok(Some(event));
}
match poll(&mut fds, timeout.leftover()) {
Err(filedescriptor::Error::Io(e)) => return Err(e),
res => res.expect("polling tty"),
Err(filedescriptor::Error::Poll(e)) | Err(filedescriptor::Error::Io(e)) => {
match e.kind() {
// retry on EINTR
io::ErrorKind::Interrupted => continue,
_ => return Err(e),
}
}
Err(e) => {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
format!("got unexpected error while polling: {:?}", e),
))
}
Ok(_) => (),
};
if fds[0].revents & POLLIN != 0 {
loop {
Expand Down