Show More
@@ -1008,8 +1008,43 b' class ui(object):' | |||||
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) | |
1009 | else: |
|
1009 | else: | |
1010 | self._buffers[-1].extend(args) |
|
1010 | self._buffers[-1].extend(args) | |
|
1011 | return | |||
|
1012 | ||||
|
1013 | # inliend _writenobuf() for speed | |||
|
1014 | self._progclear() | |||
|
1015 | msg = b''.join(args) | |||
|
1016 | ||||
|
1017 | # opencode timeblockedsection because this is a critical path | |||
|
1018 | starttime = util.timer() | |||
|
1019 | try: | |||
|
1020 | if dest is self._ferr and not getattr(self._fout, 'closed', False): | |||
|
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 | |||
|
1028 | # the color module and that is it. | |||
|
1029 | color.win32print(self, dest.write, msg, **opts) | |||
1011 | else: |
|
1030 | else: | |
1012 | self._writenobuf(dest, *args, **opts) |
|
1031 | if self._colormode is not None: | |
|
1032 | label = opts.get(r'label', '') | |||
|
1033 | msg = self.label(msg, label) | |||
|
1034 | 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: | |||
|
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) | |||
|
1045 | finally: | |||
|
1046 | self._blockedtimes['stdio_blocked'] += \ | |||
|
1047 | (util.timer() - starttime) * 1000 | |||
1013 |
|
1048 | |||
1014 | def write_err(self, *args, **opts): |
|
1049 | def write_err(self, *args, **opts): | |
1015 | self._write(self._ferr, *args, **opts) |
|
1050 | self._write(self._ferr, *args, **opts) | |
@@ -1026,6 +1061,7 b' class ui(object):' | |||||
1026 | self._writenobuf(dest, *args, **opts) |
|
1061 | self._writenobuf(dest, *args, **opts) | |
1027 |
|
1062 | |||
1028 | def _writenobuf(self, dest, *args, **opts): |
|
1063 | def _writenobuf(self, dest, *args, **opts): | |
|
1064 | # update write() as well if you touch this code | |||
1029 | self._progclear() |
|
1065 | self._progclear() | |
1030 | msg = b''.join(args) |
|
1066 | msg = b''.join(args) | |
1031 |
|
1067 |
General Comments 0
You need to be logged in to leave comments.
Login now