From e81a1c4cfce86a33eeb4a640ff51881fee4cc234 Mon Sep 17 00:00:00 2001
From: Xavier L'Heureux <xavier.lheureux@icloud.com>
Date: Wed, 26 Jun 2019 18:48:53 +0000
Subject: [PATCH] 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.

---
 src/input.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/input.rs b/src/input.rs
index 5c8ecf46..2d0aeb6b 100644
--- a/src/input.rs
+++ b/src/input.rs
@@ -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,
             };
         }
-- 
GitLab