summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorDugan Chen <thedoogster@gmail.com>2016-05-17 22:29:12 -0700
committerDugan Chen <thedoogster@gmail.com>2016-05-17 23:48:10 -0700
commit43cc6c32ce9ae28931c0abb83e6e62c9bb2616d5 (patch)
tree5abca4a86d6183a4e5e13d629ff49eb34a83d628 /ranger
parentf78eb1b6594f8c2c42f7d51379b305f2aca0474e (diff)
downloadranger-43cc6c32ce9ae28931c0abb83e6e62c9bb2616d5.tar.gz
Handle broken w3m-img pipe on exit
Diffstat (limited to 'ranger')
-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()