##// END OF EJS Templates
ui: look before you leap on sys.stderr.closed (and look nicer)...
Thomas Arendsen Hein -
r10421:452b6195 default
parent child Browse files
Show More
@@ -237,13 +237,13 b' class ui(object):'
237
237
238 def write_err(self, *args):
238 def write_err(self, *args):
239 try:
239 try:
240 if not hasattr(sys.stdout, 'closed') or not sys.stdout.closed:
240 if not getattr(sys.stdout, 'closed', False):
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.
246 if not sys.stderr.closed:
246 if not getattr(sys.stderr, 'closed', False):
247 sys.stderr.flush()
247 sys.stderr.flush()
248 except IOError, inst:
248 except IOError, inst:
249 if inst.errno != errno.EPIPE:
249 if inst.errno != errno.EPIPE:
General Comments 0
You need to be logged in to leave comments. Login now