From a907da05323a1efe8061be646e1160656a096b78 Mon Sep 17 00:00:00 2001 From: Jarrod Johnon Date: Mon, 6 Oct 2014 16:51:56 -0400 Subject: [PATCH] Avoid trying to set title on incapable terminals If running on a VC, for example, without benefit of tmux or anything, must suppress escape sequences. --- TODO | 3 ++- confluent_client/bin/confetty | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/TODO b/TODO index 6af0e4bb..93bd38e6 100644 --- a/TODO +++ b/TODO @@ -61,4 +61,5 @@ AttributeError: 'str' object has no attribute 'iterkeys' while it was trying to keep console open as much as possibl -cs._handled_consoles[('n4', None)]._console.handle_data({'error':1}) is how I was able to kick the session state back to working order after whatever event that was missed above - occurred. \ No newline at end of file + occurred. + -save and restore the terminal title on startup/exit respectively \ No newline at end of file diff --git a/confluent_client/bin/confetty b/confluent_client/bin/confetty index c11929c6..7409bfb3 100755 --- a/confluent_client/bin/confetty +++ b/confluent_client/bin/confetty @@ -96,7 +96,8 @@ def updatestatus(stateinfo={}): info.append(time.strftime('%H:%M', time.localtime(showtime))) if info: status += ' [' + ','.join(info) + ']' - sys.stdout.write('\x1b]0;console: %s\x07' % status) + if os.environ['TERM'] not in ('linux'): + sys.stdout.write('\x1b]0;console: %s\x07' % status) sys.stdout.flush() @@ -127,7 +128,8 @@ def recurse_format(datum, levels=0): def prompt(): - sys.stdout.write('\x1b]0;confetty: %s\x07' % target) + if os.environ['TERM'] not in ('linux'): + sys.stdout.write('\x1b]0;confetty: %s\x07' % target) try: return raw_input(target + ' -> ') except KeyboardInterrupt: