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

login
register
mail settings
Submitter Bryan O'Sullivan
Date April 10, 2017, 6:51 p.m.
Message ID <fdac23ea683f6b2b7688.1491850297@bryano-mbp.local>
Download mbox | patch
Permalink /patch/20093/
State Changes Requested
Headers show

Comments

Bryan O'Sullivan - April 10, 2017, 6:51 p.m.
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1490915085 25200
#      Thu Mar 30 16:04:45 2017 -0700
# Node ID fdac23ea683f6b2b76885e3aafb9a6bdb53218ab
# Parent  5134460363aeaac3c50f982c611a113344923155
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
@@ -798,8 +798,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
+            error.raisestdio(inst)
 
     def flush(self):
         # opencode timeblockedsection because this is a critical path