From 92ab6cba2dd5531e5722a8d4ec055212fef4789f Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Wed, 12 Aug 2009 20:02:47 +0000 Subject: 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/qpid@803687 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid-python-test | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'python/qpid-python-test') diff --git a/python/qpid-python-test b/python/qpid-python-test index ca6bec00fb..22063185b2 100755 --- a/python/qpid-python-test +++ b/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: -- cgit v1.2.1