
8 Dec
2012
8 Dec
'12
2:59 a.m.
commit 700b54c10c4f5cf37f250189fd76ffa6bd24cca6 Author: Damian Johnson <atagar@torproject.org> Date: Fri Dec 7 17:30:53 2012 -0800 Prompt notice when tor is starting When the prompt script is first ran it can take a while for tor to start. Giving a notice that tor is starting. This also changes the Controller instance variable from 'control' to 'controller'. I'm trying to standardize on the later to avoid a naming confict with stem.control imports. --- prompt | 6 +++--- test/prompt.py | 15 +++++++++------ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/prompt b/prompt index e833fd2..c1ba961 100755 --- a/prompt +++ b/prompt @@ -6,14 +6,14 @@ # # atagar@morrigan:~/Desktop/stem$ ./prompt # Welcome to stem's testing prompt. You currently have a controller available -# via the 'control' variable. +# via the 'controller' variable. # -# >>> control.get_info("version") +# >>> controller.get_info("version") # '0.2.1.30' # >>> quit() # # Would you like to stop the tor instance we made? (y/n, default: n): y -python -i -c "import test.prompt; test.prompt.print_usage(); control = test.prompt.controller()" +python -i -c "import test.prompt; test.prompt.print_usage(); controller = test.prompt.controller()" python -c "import test.prompt; test.prompt.stop(True)" diff --git a/test/prompt.py b/test/prompt.py index 290cd6e..b7da033 100644 --- a/test/prompt.py +++ b/test/prompt.py @@ -5,8 +5,8 @@ easier. :: >>> from test.prompt import * - >>> control = controller() - >>> control.get_info("version") + >>> controller = controller() + >>> controller.get_info("version") '0.2.1.30' >>> is_running() @@ -16,6 +16,7 @@ easier. """ import os +import sys import signal import stem.control @@ -32,7 +33,7 @@ def print_usage(): """ print "Welcome to stem's testing prompt. You currently have a controller available" - print "via the 'control' variable." + print "via the 'controller' variable." print def start(): @@ -46,7 +47,9 @@ def start(): 'ExitPolicy': 'reject *:*', } + sys.stdout.write("Starting tor...") stem.process.launch_tor_with_config(config = tor_config, completion_percent = 5) + sys.stdout.write(" done\n\n") def stop(prompt = False): """ @@ -82,7 +85,7 @@ def controller(): """ if not is_running(): start() - control = stem.control.Controller.from_port(control_port = CONTROL_PORT) - control.authenticate() - return control + controller = stem.control.Controller.from_port(control_port = CONTROL_PORT) + controller.authenticate() + return controller
4573
Age (days ago)
4573
Last active (days ago)
0 comments
1 participants
participants (1)
-
atagar@torproject.org