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
commit7b982e6c65e51c706da0708fd1557352649b4be6 (patch)
treeebe9b4810b5b3d1957c5090effbd06b92ed0057e /sphinx/util/console.py
parent3f860a5891ce5126cdd9885d3abba66b615db576 (diff)
downloadsphinx-7b982e6c65e51c706da0708fd1557352649b4be6.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 931f1ed0..4dcdd1c8 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()