[PATCH] progress: make sure stderr has isatty before calling

Augie Fackler durin42 at gmail.com
Sat Oct 9 14:56:02 UTC 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1286636152 18000
# Node ID 5202bce3cbb9b270f284ae70401c633eada1b5d6
# Parent  7178f6fedb9db000300abda8168d36a890a686c2
progress: make sure stderr has isatty before calling

Fixes issue2191.

diff --git a/hgext/progress.py b/hgext/progress.py
--- a/hgext/progress.py
+++ b/hgext/progress.py
@@ -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):



More information about the Mercurial-devel mailing list