Skip to content

Commit

Permalink
termwiz: avoid emitting a wake event on a spurious pipe wakeup
Browse files Browse the repository at this point in the history
  • Loading branch information
wez committed Jun 3, 2019
1 parent ae303fe commit c0e3bdf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions termwiz/src/terminal/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,10 @@ impl Terminal for UnixTerminal {

if pfd[2].revents != 0 {
let mut buf = [0u8; 64];
if self.wake_pipe.read(&mut buf).is_ok() {
return Ok(Some(InputEvent::Wake));
if let Ok(n) = self.wake_pipe.read(&mut buf) {
if n > 0 {
return Ok(Some(InputEvent::Wake));
}
}
}

Expand Down

0 comments on commit c0e3bdf

Please sign in to comment.