diff options
author | Rafael H. Schloming <rhs@apache.org> | 2009-08-12 20:02:47 +0000 |
---|---|---|
committer | Rafael H. Schloming <rhs@apache.org> | 2009-08-12 20:02:47 +0000 |
commit | 92ab6cba2dd5531e5722a8d4ec055212fef4789f (patch) | |
tree | f611937499373b6a5d3fcf6ada899e717ea5ad17 | |
parent | cb935a57a6b2587c5a6df289e1b3e0e377cc2652 (diff) | |
download | qpid-python-92ab6cba2dd5531e5722a8d4ec055212fef4789f.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/qpid@803687 13f79535-47bb-0310-9956-ffa450edef68
-rwxr-xr-x | python/qpid-python-test | 7 |
1 files changed, 5 insertions, 2 deletions
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: |