about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorseebye <seebye@users.noreply.github.com>2018-08-28 21:28:55 +0200
committerseebye <seebye@users.noreply.github.com>2018-08-28 21:28:55 +0200
commit4458f9e1e4aafbab2fafd46400dd3abf2762a421 (patch)
treeb82f33dc2691cc18dd73cb59d3920c4e75115277
parentda41d7ba090bc1ad58fbbe64f8ace5ea2ff8ad6e (diff)
downloadranger-4458f9e1e4aafbab2fafd46400dd3abf2762a421.tar.gz
implement quit (UeberzugImageDisplayer)
-rw-r--r--ranger/ext/img_display.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 7bc14b1b..0ef45a4a 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -686,7 +686,8 @@ class UeberzugImageDisplayer(ImageDisplayer):
 
     def initialize(self):
         """start ueberzug"""
-        if self.is_initialized and self.process.poll() is None:
+        if (self.is_initialized and self.process.poll() is None and
+                not self.process.stdin.closed):
             return
 
         self.process = Popen(['ueberzug', 'layer'],
@@ -710,8 +711,10 @@ class UeberzugImageDisplayer(ImageDisplayer):
         )
 
     def clear(self, start_x, start_y, width, height):
-        self._execute(action='remove', identifier=self.IMAGE_ID)
+        if self.process and not self.process.stdin.closed:
+            self._execute(action='remove', identifier=self.IMAGE_ID)
 
     def quit(self):
-        # ueberzug will terminate itself if stdin was closed
-        pass
+        if (self.is_initialized and self.process.poll() is None and
+                not self.process.stdin.closed):
+            self.process.stdin.close()