summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/gui/ui.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/ranger/gui/ui.py b/ranger/gui/ui.py
index 2874ee97..03a43c57 100644
--- a/ranger/gui/ui.py
+++ b/ranger/gui/ui.py
@@ -238,7 +238,7 @@ class UI(  # pylint: disable=too-many-instance-attributes,too-many-public-method
         for key in keys:
             self.handle_key(key)
 
-    def handle_input(self):
+    def handle_input(self):  # pylint: disable=too-many-branches
         key = self.win.getch()
         if key == curses.KEY_ENTER:
             key = ord('\n')
@@ -277,6 +277,9 @@ class UI(  # pylint: disable=too-many-instance-attributes,too-many-public-method
                 else:
                     if not self.fm.input_is_blocked():
                         self.handle_key(key)
+            elif key == -1 and not os.isatty(sys.stdin.fileno()):
+                # STDIN has been closed
+                self.fm.exit()
 
     def setup(self):
         """Build up the UI by initializing widgets."""