소스 검색

ignore EPIPE happens on RHEL

Matthew Wang 13 년 전
부모
커밋
29c9e1f58c
1개의 변경된 파일7개의 추가작업 그리고 2개의 파일을 삭제
  1. 7
    2
      src/cdiff.py

+ 7
- 2
src/cdiff.py 파일 보기

16
 
16
 
17
 import os
17
 import os
18
 import re
18
 import re
19
+import errno
19
 import difflib
20
 import difflib
20
 
21
 
21
 
22
 
492
         # args stolen fron git source: github.com/git/git/blob/master/pager.c
493
         # args stolen fron git source: github.com/git/git/blob/master/pager.c
493
         pager = subprocess.Popen(['less', '-FRSXK'],
494
         pager = subprocess.Popen(['less', '-FRSXK'],
494
                 stdin=subprocess.PIPE, stdout=sys.stdout)
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
         pager.stdin.close()
503
         pager.stdin.close()
499
         pager.wait()
504
         pager.wait()