summaryrefslogtreecommitdiff
path: root/sphinx/util/console.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-05-10 21:06:34 +0200
committerGeorg Brandl <georg@python.org>2009-05-10 21:06:34 +0200
commit64d2c2c795e9e47474689fbf39ab0afc647a8397 (patch)
treeebe9b4810b5b3d1957c5090effbd06b92ed0057e /sphinx/util/console.py
parentef01782f42aaacadb50cc702584c0317f2d6ce54 (diff)
downloadsphinx-git-64d2c2c795e9e47474689fbf39ab0afc647a8397.tar.gz
#159: do not fail if sys.stdout has no isatty() method.
Diffstat (limited to 'sphinx/util/console.py')
-rw-r--r--sphinx/util/console.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/sphinx/util/console.py b/sphinx/util/console.py
index 931f1ed04..4dcdd1c8d 100644
--- a/sphinx/util/console.py
+++ b/sphinx/util/console.py
@@ -10,6 +10,7 @@
"""
import os
+import sys
codes = {}
@@ -38,6 +39,10 @@ def term_width_line(text):
return text.ljust(_tw) + '\r'
def color_terminal():
+ if not hasattr(sys.stdout, 'isatty'):
+ return False
+ if not sys.stdout.isatty():
+ return False
if 'COLORTERM' in os.environ:
return True
term = os.environ.get('TERM', 'dumb').lower()