##// END OF EJS Templates
ui: remove unreachable branches and function calls from write() (issue6059)...
Yuya Nishihara -
r41378:26ee61c3 stable
parent child Browse files
Show More
@@ -1002,7 +1002,7 b' class ui(object):'
1002 dest = self._fout
1002 dest = self._fout
1003
1003
1004 # inlined _write() for speed
1004 # inlined _write() for speed
1005 if self._isbuffered(dest):
1005 if self._buffers:
1006 label = opts.get(r'label', '')
1006 label = opts.get(r'label', '')
1007 if label and self._bufferapplylabels:
1007 if label and self._bufferapplylabels:
1008 self._buffers[-1].extend(self.label(a, label) for a in args)
1008 self._buffers[-1].extend(self.label(a, label) for a in args)
@@ -1017,13 +1017,7 b' class ui(object):'
1017 # opencode timeblockedsection because this is a critical path
1017 # opencode timeblockedsection because this is a critical path
1018 starttime = util.timer()
1018 starttime = util.timer()
1019 try:
1019 try:
1020 if dest is self._ferr and not getattr(self._fout, 'closed', False):
1020 if self._colormode == 'win32':
1021 self._fout.flush()
1022 if getattr(dest, 'structured', False):
1023 # channel for machine-readable output with metadata, where
1024 # no extra colorization is necessary.
1025 dest.write(msg, **opts)
1026 elif self._colormode == 'win32':
1027 # windows color printing is its own can of crab, defer to
1021 # windows color printing is its own can of crab, defer to
1028 # the color module and that is it.
1022 # the color module and that is it.
1029 color.win32print(self, dest.write, msg, **opts)
1023 color.win32print(self, dest.write, msg, **opts)
@@ -1032,15 +1026,7 b' class ui(object):'
1032 label = opts.get(r'label', '')
1026 label = opts.get(r'label', '')
1033 msg = self.label(msg, label)
1027 msg = self.label(msg, label)
1034 dest.write(msg)
1028 dest.write(msg)
1035 # stderr may be buffered under win32 when redirected to files,
1036 # including stdout.
1037 if dest is self._ferr and not getattr(self._ferr, 'closed', False):
1038 dest.flush()
1039 except IOError as err:
1029 except IOError as err:
1040 if (dest is self._ferr
1041 and err.errno in (errno.EPIPE, errno.EIO, errno.EBADF)):
1042 # no way to report the error, so ignore it
1043 return
1044 raise error.StdioError(err)
1030 raise error.StdioError(err)
1045 finally:
1031 finally:
1046 self._blockedtimes['stdio_blocked'] += \
1032 self._blockedtimes['stdio_blocked'] += \
General Comments 0
You need to be logged in to leave comments. Login now