qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r803687 - /qpid/trunk/qpid/python/qpid-python-test
Date Wed, 12 Aug 2009 20:02:48 GMT
Author: rhs
Date: Wed Aug 12 20:02:47 2009
New Revision: 803687

URL: http://svn.apache.org/viewvc?rev=803687&view=rev
Log:
check the TERM environment variable as well as isatty to determine how smart the terminal
is

Modified:
    qpid/trunk/qpid/python/qpid-python-test

Modified: qpid/trunk/qpid/python/qpid-python-test
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid-python-test?rev=803687&r1=803686&r2=803687&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid-python-test (original)
+++ qpid/trunk/qpid/python/qpid-python-test Wed Aug 12 20:02:47 2009
@@ -123,8 +123,11 @@
       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 @@
             "ignored": (33,),
             "selected": (34,)}
 
-COLORIZE = sys.stdout.isatty()
+COLORIZE = is_smart()
 
 def colorize_word(word, text=None):
   if text is None:



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message