progress: make sure stderr has isatty before calling (issue2191)
authorAugie Fackler <durin42@gmail.com>
Sat, 09 Oct 2010 09:55:52 -0500
changeset 12654 646eb9337c87
parent 12653 5096faaa280e
child 12655 5192b24f309c
progress: make sure stderr has isatty before calling (issue2191)
hgext/progress.py
--- a/hgext/progress.py	Sat Oct 09 18:04:36 2010 +0200
+++ b/hgext/progress.py	Sat Oct 09 09:55:52 2010 -0500
@@ -51,7 +51,8 @@
     return ' '.join(s for s in args if s)
 
 def shouldprint(ui):
-    return sys.stderr.isatty() or ui.configbool('progress', 'assume-tty')
+    return (getattr(sys.stderr, 'isatty', None) and
+            (sys.stderr.isatty() or ui.configbool('progress', 'assume-tty')))
 
 class progbar(object):
     def __init__(self, ui):