[tor-commits] [arm/release] Implementing /quit option

atagar at torproject.org atagar at torproject.org
Sun Sep 25 21:38:27 UTC 2011


commit 8f4e5b819302db174881fa0d630cf0d0c31ce942
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Aug 30 09:49:45 2011 -0700

    Implementing /quit option
---
 src/util/torInterpretor.py |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/src/util/torInterpretor.py b/src/util/torInterpretor.py
index e062532..d73e84f 100644
--- a/src/util/torInterpretor.py
+++ b/src/util/torInterpretor.py
@@ -241,7 +241,11 @@ class ControlInterpretor:
     if input.startswith("/"):
       # interpretor command
       inputEntry.append((input, INPUT_INTERPRETOR_FORMAT))
-      outputEntry.append(("Not yet implemented...", ERROR_FORMAT)) # TODO: implement
+      
+      if input == "/quit":
+        raise InterpretorClosed()
+      else:
+        outputEntry.append(("Not yet implemented...", ERROR_FORMAT)) # TODO: implement
       
       # TODO: add /help option
       # TODO: add /write option
@@ -315,17 +319,16 @@ def prompt():
   readline.set_completer_delims("\n")
   interpretor = ControlInterpretor()
   
-  while input != "/quit":
+  while True:
     try:
       input = raw_input(prompt)
+      _, outputEntry = interpretor.handleQuery(input)
     except:
       # moves cursor to the next line and terminates (most commonly
       # KeyboardInterrupt and EOFErro)
       print
       break
     
-    _, outputEntry = interpretor.handleQuery(input)
-    
     for line in outputEntry:
       outputLine = ""
       





More information about the tor-commits mailing list