commit 954f194560e43ac8e4fa588abc041a1d7a98ef31 Author: Damian Johnson atagar@torproject.org Date: Fri Jun 14 09:03:55 2013 -0700
Warning rather than attempting to correct TERM
Lunar^ points out that setting the user's TERM could cause issues. Replacing it with a warning...
atagar@morrigan:~/Desktop/arm$ TERM=rxvt-unicode-256color arm Unknown $TERM: (rxvt-unicode-256color) Either update your terminfo database or run arm using "TERM=xterm arm". --- arm | 2 -- src/cli/controller.py | 15 +++++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/arm b/arm index 040ef4b..0a23aaa 100755 --- a/arm +++ b/arm @@ -9,8 +9,6 @@ else arm_base=$( dirname "$0" )/src/ fi
-TERM=xterm # other terms, like rxvt-unicode-256color, can cause curses to fail - python "${arm_base}prereq.py" $*
if [ $? = 0 ]; then diff --git a/src/cli/controller.py b/src/cli/controller.py index 58bd41d..0ef07d8 100644 --- a/src/cli/controller.py +++ b/src/cli/controller.py @@ -6,6 +6,7 @@ user input to the proper panels. import os import time import curses +import sys import threading
import cli.menu.menu @@ -444,8 +445,10 @@ def shutdownDaemons():
# stops panel daemons control = getController() - for panelImpl in control.getDaemonPanels(): panelImpl.stop() - for panelImpl in control.getDaemonPanels(): panelImpl.join() + + if control: + for panelImpl in control.getDaemonPanels(): panelImpl.stop() + for panelImpl in control.getDaemonPanels(): panelImpl.join()
# joins on stem threads torTools.getConn().close() @@ -562,6 +565,14 @@ def startTorMonitor(startTime):
try: curses.wrapper(drawTorMonitor, startTime) + except UnboundLocalError, exc: + if os.environ['TERM'] != 'xterm': + shutdownDaemons() + print 'Unknown $TERM: (%s)' % os.environ['TERM'] + print 'Either update your terminfo database or run arm using "TERM=xterm arm".' + print + else: + raise exc except KeyboardInterrupt: # Skip printing stack trace in case of keyboard interrupt. The # HALT_ACTIVITY attempts to prevent daemons from triggering a curses redraw
tor-commits@lists.torproject.org