Mercurial > public > mercurial-scm > hg
comparison mercurial/ui.py @ 10383:f83291e5643e
ui: look before you leap on sys.stdout.closed
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 07 Feb 2010 16:44:55 +0100 |
parents | 08a0f04b56bd |
children | 452b6195e94c f8a9de664a1c |
comparison
equal
deleted
inserted
replaced
10382:e54e3f6e6789 | 10383:f83291e5643e |
---|---|
235 for a in args: | 235 for a in args: |
236 sys.stdout.write(str(a)) | 236 sys.stdout.write(str(a)) |
237 | 237 |
238 def write_err(self, *args): | 238 def write_err(self, *args): |
239 try: | 239 try: |
240 if not sys.stdout.closed: | 240 if not hasattr(sys.stdout, 'closed') or not sys.stdout.closed: |
241 sys.stdout.flush() | 241 sys.stdout.flush() |
242 for a in args: | 242 for a in args: |
243 sys.stderr.write(str(a)) | 243 sys.stderr.write(str(a)) |
244 # stderr may be buffered under win32 when redirected to files, | 244 # stderr may be buffered under win32 when redirected to files, |
245 # including stdout. | 245 # including stdout. |