620 When labeling output for a specific command, a label of |
620 When labeling output for a specific command, a label of |
621 "cmdname.type" is recommended. For example, status issues |
621 "cmdname.type" is recommended. For example, status issues |
622 a label of "status.modified" for modified files. |
622 a label of "status.modified" for modified files. |
623 ''' |
623 ''' |
624 if self._buffers: |
624 if self._buffers: |
625 self._buffers[-1].extend([str(a) for a in args]) |
625 self._buffers[-1].extend(a for a in args) |
626 else: |
626 else: |
627 self._progclear() |
627 self._progclear() |
628 for a in args: |
628 for a in args: |
629 self.fout.write(str(a)) |
629 self.fout.write(a) |
630 |
630 |
631 def write_err(self, *args, **opts): |
631 def write_err(self, *args, **opts): |
632 self._progclear() |
632 self._progclear() |
633 try: |
633 try: |
634 if self._bufferstates and self._bufferstates[-1][0]: |
634 if self._bufferstates and self._bufferstates[-1][0]: |
635 return self.write(*args, **opts) |
635 return self.write(*args, **opts) |
636 if not getattr(self.fout, 'closed', False): |
636 if not getattr(self.fout, 'closed', False): |
637 self.fout.flush() |
637 self.fout.flush() |
638 for a in args: |
638 for a in args: |
639 self.ferr.write(str(a)) |
639 self.ferr.write(a) |
640 # stderr may be buffered under win32 when redirected to files, |
640 # stderr may be buffered under win32 when redirected to files, |
641 # including stdout. |
641 # including stdout. |
642 if not getattr(self.ferr, 'closed', False): |
642 if not getattr(self.ferr, 'closed', False): |
643 self.ferr.flush() |
643 self.ferr.flush() |
644 except IOError as inst: |
644 except IOError as inst: |