changeset 1989:0541768fa558

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.
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 23 Mar 2006 23:16:41 +0100
parents 18a3e6369600
children a8a618c57690
files mercurial/ui.py
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- 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: