##// END OF EJS Templates
ui: simplify interface of low-level write() functions...
Yuya Nishihara -
r40556:49746e53 default
parent child Browse files
Show More
@@ -529,7 +529,7 b' if pycompat.iswindows:'
529 529 attr = mapcolor(int(sattr), attr)
530 530 ui.flush()
531 531 _kernel32.SetConsoleTextAttribute(stdout, attr)
532 writefunc(m.group(2), **opts)
532 writefunc(m.group(2))
533 533 m = re.match(ansire, m.group(3))
534 534 finally:
535 535 # Explicitly reset original attributes
@@ -960,13 +960,13 b' class ui(object):'
960 960 if self._colormode is not None:
961 961 label = opts.get(r'label', '')
962 962 msgs = [self.label(a, label) for a in args]
963 write(*msgs, **opts)
963 write(b''.join(msgs))
964 964
965 def _write(self, *msgs, **opts):
965 def _write(self, data):
966 966 # opencode timeblockedsection because this is a critical path
967 967 starttime = util.timer()
968 968 try:
969 self.fout.write(''.join(msgs))
969 self.fout.write(data)
970 970 except IOError as err:
971 971 raise error.StdioError(err)
972 972 finally:
@@ -979,13 +979,12 b' class ui(object):'
979 979 else:
980 980 self._writenobuf(self._write_err, *args, **opts)
981 981
982 def _write_err(self, *msgs, **opts):
982 def _write_err(self, data):
983 983 try:
984 984 with self.timeblockedsection('stdio'):
985 985 if not getattr(self.fout, 'closed', False):
986 986 self.fout.flush()
987 for a in msgs:
988 self.ferr.write(a)
987 self.ferr.write(data)
989 988 # stderr may be buffered under win32 when redirected to files,
990 989 # including stdout.
991 990 if not getattr(self.ferr, 'closed', False):
General Comments 0
You need to be logged in to leave comments. Login now