summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2009-08-12 20:02:47 +0000
committerRafael H. Schloming <rhs@apache.org>2009-08-12 20:02:47 +0000
commitbcf296290a524c0d775bc9c741d212ba6aa62d40 (patch)
tree69e10ff0965337f3468475a15226eb1dceb55593
parent77e7a30b2c5d08465664b86c806cd2c0fa0f5e37 (diff)
downloadqpid-python-bcf296290a524c0d775bc9c741d212ba6aa62d40.tar.gz
check the TERM environment variable as well as isatty to determine how smart the terminal is
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@803687 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-xqpid/python/qpid-python-test7
1 files changed, 5 insertions, 2 deletions
diff --git a/qpid/python/qpid-python-test b/qpid/python/qpid-python-test
index ca6bec00fb..22063185b2 100755
--- a/qpid/python/qpid-python-test
+++ b/qpid/python/qpid-python-test
@@ -123,8 +123,11 @@ def is_included(path):
return True
return False
+def is_smart():
+ return sys.stdout.isatty() and os.environ.get("TERM", "dumb") != "dumb"
+
def width():
- if sys.stdout.isatty():
+ if is_smart():
s = struct.pack("HHHH", 0, 0, 0, 0)
fd_stdout = sys.stdout.fileno()
x = fcntl.ioctl(fd_stdout, termios.TIOCGWINSZ, s)
@@ -155,7 +158,7 @@ KEYWORDS = {"pass": (32,),
"ignored": (33,),
"selected": (34,)}
-COLORIZE = sys.stdout.isatty()
+COLORIZE = is_smart()
def colorize_word(word, text=None):
if text is None: