Browse Source

ignore EPIPE happens on RHEL

Matthew Wang 12 years ago
parent
commit
29c9e1f58c
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      src/cdiff.py

+ 7
- 2
src/cdiff.py View File

@@ -16,6 +16,7 @@ if sys.hexversion < 0x02050000:
16 16
 
17 17
 import os
18 18
 import re
19
+import errno
19 20
 import difflib
20 21
 
21 22
 
@@ -492,8 +493,12 @@ if __name__ == '__main__':
492 493
         # args stolen fron git source: github.com/git/git/blob/master/pager.c
493 494
         pager = subprocess.Popen(['less', '-FRSXK'],
494 495
                 stdin=subprocess.PIPE, stdout=sys.stdout)
495
-        for line in color_diff:
496
-            pager.stdin.write(line)
496
+        try:
497
+            for line in color_diff:
498
+                pager.stdin.write(line)
499
+        except IOError as e:
500
+            if e.errno == errno.EPIPE:
501
+                pass
497 502
 
498 503
         pager.stdin.close()
499 504
         pager.wait()