diff mercurial/commands.py @ 832:b65773f7db41

Handle broken pipe on pressing Ctrl-C with e.g. 'hg log|grep something'.
author Thomas Arendsen Hein <thomas@intevation.de>
date Thu, 04 Aug 2005 18:06:49 +0100
parents eef752151556
children 1fe3b14c7044
line wrap: on
line diff
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1400,7 +1400,14 @@ def dispatch(args):
     except SignalInterrupt:
         u.warn("killed!\n")
     except KeyboardInterrupt:
-        u.warn("interrupted!\n")
+        try:
+            u.warn("interrupted!\n")
+        except IOError, inst:
+            if inst.errno == errno.EPIPE:
+                if u.debugflag:
+                    u.warn("\nbroken pipe\n")
+            else:
+                raise
     except IOError, inst:
         if hasattr(inst, "code"):
             u.warn("abort: %s\n" % inst)