summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/ext/img_display.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ranger/ext/img_display.py b/ranger/ext/img_display.py
index 9df64316..0c6a11d4 100644
--- a/ranger/ext/img_display.py
+++ b/ranger/ext/img_display.py
@@ -11,6 +11,7 @@ implementations, which are currently w3m and iTerm2.
 
 import base64
 import curses
+import errno
 import fcntl
 import imghdr
 import os
@@ -117,7 +118,13 @@ class W3MImageDisplayer(ImageDisplayer):
                 h = height * fonth + 1)
                 # h = (height - 1) * fonth + 1) # (for tmux top status bar)
 
-        self.process.stdin.write(cmd)
+        try:
+            self.process.stdin.write(cmd)
+        except IOError as e:
+            if e.errno == errno.EPIPE:
+                return
+            else:
+                raise e
         self.process.stdin.flush()
         self.process.stdout.readline()