[PATCH] ui: ignore EIO in write_err

Mads Kiilerich mads at kiilerich.com
Sun Jun 20 11:03:11 CDT 2010


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.
>
>    
>> 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?

/Mads



More information about the Mercurial-devel mailing list