# HG changeset patch # User Goffi # Date 1487831610 -3600 # Node ID a0fbb2b11fd05793ae7844ef92b238bb9ffec139 # Parent 63d191c05ecd5c51ff6613fa93b3ba9422c6efb5 tools (common): fixed tty detection when isatty is not available diff -r 63d191c05ecd -r a0fbb2b11fd0 src/tools/common/ansi.py --- a/src/tools/common/ansi.py Tue Feb 21 21:01:40 2017 +0100 +++ b/src/tools/common/ansi.py Thu Feb 23 07:33:30 2017 +0100 @@ -42,8 +42,13 @@ return u''.join(args) -if not sys.stdout.isatty(): +try: + tty = sys.stdout.isatty() +except AttributeError: + tty = False +if not tty: # we don't want ANSI escape codes if we are not outputing to a tty! for attr in dir(ANSI): if isinstance(getattr(ANSI, attr), basestring): setattr(ANSI, attr, u'') +del tty