Mercurial > public > mercurial-scm > hg-stable
diff hgext/progress.py @ 14515:76f295eaed86
util: add helper function isatty(fd) to check for tty-ness
author | Idan Kamara <idankk86@gmail.com> |
---|---|
date | Thu, 02 Jun 2011 00:43:34 +0300 |
parents | 98e4d3914c2e |
children | 925cab23d7d5 |
line wrap: on
line diff
--- a/hgext/progress.py Thu Jun 02 18:52:31 2011 +0800 +++ b/hgext/progress.py Thu Jun 02 00:43:34 2011 +0300 @@ -46,14 +46,14 @@ import sys import time +from mercurial import util from mercurial.i18n import _ def spacejoin(*args): return ' '.join(s for s in args if s) def shouldprint(ui): - return (getattr(sys.stderr, 'isatty', None) and - (sys.stderr.isatty() or ui.configbool('progress', 'assume-tty'))) + return (util.isatty(sys.stderr) or ui.configbool('progress', 'assume-tty')) def fmtremaining(seconds): if seconds < 60: