[PATCH] progress ext: check for stderr.isatty existing before calling

Ronny Pfannschmidt Ronny.Pfannschmidt at gmx.de
Wed Sep 1 15:11:08 CDT 2010


# HG changeset patch
# User Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
# Date 1283348268 -7200
# Node ID 3b2570bb9b19fc19c14a11604fb71a356af205bb
# Parent  d01e28657429815d4b83098e2ff5dd0d72e961e6
progress ext: check for stderr.isatty existing before calling

diff --git a/hgext/progress.py b/hgext/progress.py
--- a/hgext/progress.py
+++ b/hgext/progress.py
@@ -51,7 +51,8 @@ def spacejoin(*args):
     return ' '.join(s for s in args if s)
 
 def shouldprint(ui):
-    return sys.stderr.isatty() or ui.configbool('progress', 'assume-tty')
+    return hasattr(sys.stderr, 'isatty') and sys.stderr.isatty() \
+           or ui.configbool('progress', 'assume-tty')
 
 class progbar(object):
     def __init__(self, ui):


More information about the Mercurial-devel mailing list