ignore EPIPE in ui.err_write
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Thu, 23 Mar 2006 23:16:41 +0100
changeset 1989 0541768fa558
parent 1988 18a3e6369600
child 1991 a8a618c57690
ignore EPIPE in ui.err_write It avoids not being able to abort a transaction when a push via ssh fails. Maybe some other place should ignore EPIPE too.
mercurial/ui.py
--- a/mercurial/ui.py	Tue Mar 21 23:31:04 2006 -0800
+++ b/mercurial/ui.py	Thu Mar 23 23:16:41 2006 +0100
@@ -8,7 +8,7 @@
 import ConfigParser
 from i18n import gettext as _
 from demandload import *
-demandload(globals(), "os re socket sys util tempfile")
+demandload(globals(), "errno os re socket sys tempfile util")
 
 class ui(object):
     def __init__(self, verbose=False, debug=False, quiet=False,
@@ -179,9 +179,13 @@
             sys.stdout.write(str(a))
 
     def write_err(self, *args):
-        if not sys.stdout.closed: sys.stdout.flush()
-        for a in args:
-            sys.stderr.write(str(a))
+        try:
+            if not sys.stdout.closed: sys.stdout.flush()
+            for a in args:
+                sys.stderr.write(str(a))
+        except IOError, inst:
+            if inst.errno != errno.EPIPE:
+                raise
 
     def flush(self):
         try: