Make the keys return their inner error, if any. For example, when permission to access the TTY is denied, don't loop infinitely and instead return to the outer scope to error and exit (or not) there.

This commit is contained in:
Xavier L'Heureux 2019-06-26 18:48:53 +00:00
parent 68d765305c
commit e81a1c4cfc
1 changed files with 1 additions and 1 deletions

View File

@ -19,7 +19,7 @@ impl<R: Read> Iterator for Keys<R> {
match self.iter.next() {
Some(Ok(Event::Key(k))) => return Some(Ok(k)),
Some(Ok(_)) => continue,
e @ Some(Err(_)) => e,
Some(Err(e)) => return Some(Err(e)),
None => return None,
};
}