Patchwork [7,of,9,v2] stdio: raise StdioError if something goes wrong in ui._write_err

login
register
mail settings
Submitter Bryan O'Sullivan
Date April 14, 2017, 4:29 a.m.
Message ID <fa74f393eaa5663b943e.1492144185@jsdf-mbp.dhcp.thefacebook.com>
Download mbox | patch
Permalink /patch/20190/
State Accepted
Headers show

Comments

Bryan O'Sullivan - April 14, 2017, 4:29 a.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1491947652 25200
#      Tue Apr 11 14:54:12 2017 -0700
# Node ID fa74f393eaa5663b943eb0544ad4723ae7371385
# Parent  e2a4bc13996100c5409f2e8561143e9fdad758a9
stdio: raise StdioError if something goes wrong in ui._write_err

The prior code used to ignore certain classes of error, which was
not the right thing to do.

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -801,8 +801,7 @@  class ui(object):
                 if not getattr(self.ferr, 'closed', False):
                     self.ferr.flush()
         except IOError as inst:
-            if inst.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
-                raise
+            raise error.StdioError(inst)
 
     def flush(self):
         # opencode timeblockedsection because this is a critical path