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

Augie Fackler durin42 at gmail.com
Wed Sep 1 21:34:44 CDT 2010


On Sep 1, 2010, at 3:11 PM, Ronny Pfannschmidt wrote:

> # 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')

I guess it sorta makes sense, but is there some particular case that's  
inspired this? Perhaps something testable?

> class progbar(object):
>     def __init__(self, ui):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list