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

Bryan O'Sullivan bos at serpentine.com
Fri Apr 14 00:29:45 EDT 2017


# HG changeset patch
# User Bryan O'Sullivan <bryano at 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.

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


More information about the Mercurial-devel mailing list