Show More
@@ -962,6 +962,8 b' class ui(object):' | |||||
962 | # opencode timeblockedsection because this is a critical path |
|
962 | # opencode timeblockedsection because this is a critical path | |
963 | starttime = util.timer() |
|
963 | starttime = util.timer() | |
964 | try: |
|
964 | try: | |
|
965 | if dest is self.ferr and not getattr(self.fout, 'closed', False): | |||
|
966 | self.fout.flush() | |||
965 | if self._colormode == 'win32': |
|
967 | if self._colormode == 'win32': | |
966 | # windows color printing is its own can of crab, defer to |
|
968 | # windows color printing is its own can of crab, defer to | |
967 | # the color module and that is it. |
|
969 | # the color module and that is it. | |
@@ -971,15 +973,22 b' class ui(object):' | |||||
971 | label = opts.get(r'label', '') |
|
973 | label = opts.get(r'label', '') | |
972 | msg = self.label(msg, label) |
|
974 | msg = self.label(msg, label) | |
973 | write(msg) |
|
975 | write(msg) | |
|
976 | # stderr may be buffered under win32 when redirected to files, | |||
|
977 | # including stdout. | |||
|
978 | if dest is self.ferr and not getattr(self.ferr, 'closed', False): | |||
|
979 | dest.flush() | |||
|
980 | except IOError as err: | |||
|
981 | if (dest is self.ferr | |||
|
982 | and err.errno in (errno.EPIPE, errno.EIO, errno.EBADF)): | |||
|
983 | # no way to report the error, so ignore it | |||
|
984 | return | |||
|
985 | raise error.StdioError(err) | |||
974 | finally: |
|
986 | finally: | |
975 | self._blockedtimes['stdio_blocked'] += \ |
|
987 | self._blockedtimes['stdio_blocked'] += \ | |
976 | (util.timer() - starttime) * 1000 |
|
988 | (util.timer() - starttime) * 1000 | |
977 |
|
989 | |||
978 | def _write(self, data): |
|
990 | def _write(self, data): | |
979 | try: |
|
991 | self.fout.write(data) | |
980 | self.fout.write(data) |
|
|||
981 | except IOError as err: |
|
|||
982 | raise error.StdioError(err) |
|
|||
983 |
|
992 | |||
984 | def write_err(self, *args, **opts): |
|
993 | def write_err(self, *args, **opts): | |
985 | if self._bufferstates and self._bufferstates[-1][0]: |
|
994 | if self._bufferstates and self._bufferstates[-1][0]: | |
@@ -988,18 +997,7 b' class ui(object):' | |||||
988 | self._writenobuf(self.ferr, *args, **opts) |
|
997 | self._writenobuf(self.ferr, *args, **opts) | |
989 |
|
998 | |||
990 | def _write_err(self, data): |
|
999 | def _write_err(self, data): | |
991 | try: |
|
1000 | self.ferr.write(data) | |
992 | if True: |
|
|||
993 | if not getattr(self.fout, 'closed', False): |
|
|||
994 | self.fout.flush() |
|
|||
995 | self.ferr.write(data) |
|
|||
996 | # stderr may be buffered under win32 when redirected to files, |
|
|||
997 | # including stdout. |
|
|||
998 | if not getattr(self.ferr, 'closed', False): |
|
|||
999 | self.ferr.flush() |
|
|||
1000 | except IOError as inst: |
|
|||
1001 | if inst.errno not in (errno.EPIPE, errno.EIO, errno.EBADF): |
|
|||
1002 | raise error.StdioError(inst) |
|
|||
1003 |
|
1001 | |||
1004 | def flush(self): |
|
1002 | def flush(self): | |
1005 | # opencode timeblockedsection because this is a critical path |
|
1003 | # opencode timeblockedsection because this is a critical path |
General Comments 0
You need to be logged in to leave comments.
Login now