commit b86e5bf8d186124e3e7cc7d76e737b33bf174ab0 Author: Damian Johnson atagar@torproject.org Date: Fri Dec 23 08:11:54 2011 -0800
Skipping import of readline when showing cli
Commit 3e1a135, which added a startup option for running the control interpretor without the rest of arm, also caused us to inadvertantly import the readline module prior to starting curses. This import ordering royally screws the terminal in some use cases, most noticeably if you... - start arm within a screen session - detatch and resize the terminal - reattach to the screen session
I've seen several other terminal glitches that I'm suspecting is related to this too, but until now didn't have a repro case. I'm fixing this by removing the readline import entirely unless we're specifically showing the prompt.
Thanks to Stephan Seitz for catching this and suggesting a repo! --- src/util/torInterpretor.py | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/src/util/torInterpretor.py b/src/util/torInterpretor.py index 1ff3b84..4fa0dff 100644 --- a/src/util/torInterpretor.py +++ b/src/util/torInterpretor.py @@ -6,7 +6,6 @@ directly, history and tab completion.
import re import sys -import readline
import version
@@ -961,6 +960,13 @@ class ControlInterpretor: return (inputLines, outputLines)
def showPrompt(): + # When displaying the prompt we want the readline module to be imported so + # we get its neat features like history scrollback. HOWEVER, importing + # readline prior to initializing curses causes terminal bugs, most noticeably + # screen resizing. + + import readline + # For Python 2.6 and earlier cycling history via the readline module with # up/down is buggy with a color prompt. For more information see: # http://bugs.python.org/issue12972