[PATCH] ui: ignore EIO in write_err

Benoit Boissinot bboissin at gmail.com
Sun Jun 20 11:34:42 CDT 2010

On Sun, Jun 20, 2010 at 06:03:11PM +0200, Mads Kiilerich wrote:
> Martin Geisler wrote, On 06/20/2010 04:11 PM:
> >Mads Kiilerich<mads at kiilerich.com>  writes:
> >
> >>On 06/16/2010 09:20 AM, Dirkjan Ochtman wrote:
> >>>On Wed, Jun 16, 2010 at 00:24, Mads Kiilerich<mads at kiilerich.com>   wrote:
> >>>>diff --git a/mercurial/ui.py b/mercurial/ui.py
> >>>>--- a/mercurial/ui.py
> >>>>+++ b/mercurial/ui.py
> >>>>@@ -369,7 +369,7 @@
> >>>>              if not getattr(sys.stderr, 'closed', False):
> >>>>                  sys.stderr.flush()
> >>>>          except IOError, inst:
> >>>>-            if inst.errno != errno.EPIPE:
> >>>>+            if inst.errno not in [errno.EPIPE, errno.EIO]:
> >>>>                  raise
> >>>>
> >>>>      def flush(self):
> >>>Nit: this feels like it should be a tuple, not a list.
> >>I feel like lists are more like "columns" where all the items have the
> >>same type, while tuples are more like "rows" where the items have
> >>different types and different semantics depending on their position.
> >>In this case it _is_ a list, not a tuple. We could use tuples to
> >>implement immutable lists, but I prefer the clarity of using lists for
> >>lists.
> >In principle, I see lists as mutable, ordered collections of homogeneous
> >values where the exact position does not matter. But it's also common to
> >use tuples for small fixes-size lists, tough a list is nicer.

FYI, I think it's better to use tuples when it's immutable.
> >
> >>A better question could however be if there is any reason why we
> >>shouldn't ignore all IOErrors in write_err - that would avoid this
> >>discussion ,-)
> >Do you think that is better, or should I push your current patch?
> I assume that tonfa tried to fix a specific problem with minimal
> impact in 0541768fa558 4 years ago. This patch fixes a similar
> problem the same way, so I think the patch is fine. Push it -
> especially if you are in the list camp ;-)
> Ignoring all exceptions is more extreme, and people might have an
> opinion about it: Which writing-to-stderr-exceptions could we want
> to propagate - especially considering that we write to stderr in our
> last resort exception handling?
> Tonfa, do you recall any specific reasons why you choose to catch
> EPIPE only?

I usually try to catch only "safe" errors, especially with IOError or
OSError as it could hide some more serious problem.
I guess people reported a traceback with EPIPE and I added it.




More information about the Mercurial-devel mailing list