Patchwork D2245: ui: coerce system exception to bytes before dropping it in our StdioError

login
register
mail settings
Submitter phabricator
Date Feb. 14, 2018, 12:13 a.m.
Message ID <differential-rev-PHID-DREV-s5sa7kychjqix3rimqeo-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/27864/
State Superseded
Headers show

Comments

phabricator - Feb. 14, 2018, 12:13 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2245

AFFECTED FILES
  mercurial/ui.py

CHANGE DETAILS




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - Feb. 14, 2018, 11:29 a.m.
yuja added a comment.


  This breaks test-basic.t and is wrong because StdioError is an IOError,
  which takes a system string.
  
    @@ -36,10 +36,10 @@
    
     #if devfull
       $ hg status >/dev/full 2>&1
    -  [255]
    +  [1]
    
       $ hg status ENOENT 2>/dev/full
    -  [255]
    +  [1]
     #endif
  
  I'll drop this from hg-committed.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2245

To: durin42, #hg-reviewers, indygreg
Cc: yuja, mercurial-devel

Patch

diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -958,7 +958,7 @@ 
                     self.ferr.flush()
         except IOError as inst:
             if inst.errno not in (errno.EPIPE, errno.EIO, errno.EBADF):
-                raise error.StdioError(inst)
+                raise error.StdioError(pycompat.bytestr(inst))
 
     def flush(self):
         # opencode timeblockedsection because this is a critical path