[tor-commits] [stem/master] Fix tor-prompt initialization

atagar at torproject.org atagar at torproject.org
Wed Aug 12 00:06:19 UTC 2020


commit d7eb8827c36876f58ffcd4a3e43a9dc507f4cf91
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Aug 8 16:28:02 2020 -0700

    Fix tor-prompt initialization
    
    Tor's present commit (67fc69c) isn't providing a bootstrap message with
    progress above 0% so dropping that requirement. Also fixing...
    
      Traceback (most recent call last):
        File "./tor-prompt", line 8, in <module>
          stem.interpreter.main()
        File "/home/atagar/Desktop/stem/stem/interpreter/__init__.py", line 109, in main
          password_prompt = True,
        File "/home/atagar/Desktop/stem/stem/connection.py", line 285, in connect
          connection = asyncio.run_coroutine_threadsafe(connect_async(control_port, control_socket, password, password_prompt, chroot_path, controller), loop).result()
        File "/home/atagar/Python-3.7.0/Lib/concurrent/futures/_base.py", line 432, in result
          return self.__get_result()
        File "/home/atagar/Python-3.7.0/Lib/concurrent/futures/_base.py", line 384, in __get_result
          raise self._exception
        File "/home/atagar/Desktop/stem/stem/connection.py", line 363, in connect_async
          raise ValueError("'%s' isn't a valid port" % control_port[1])
      ValueError: 'None' isn't a valid port
---
 stem/interpreter/__init__.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/stem/interpreter/__init__.py b/stem/interpreter/__init__.py
index a9301329..1445d9bb 100644
--- a/stem/interpreter/__init__.py
+++ b/stem/interpreter/__init__.py
@@ -16,6 +16,7 @@ import stem.util.conf
 import stem.util.system
 import stem.util.term
 
+from typing import Tuple, Union
 from stem.util.term import Attr, Color, format
 
 __all__ = [
@@ -85,14 +86,14 @@ def main() -> None:
               'ExitPolicy': 'reject *:*',
             },
             tor_cmd = args.tor_path,
-            completion_percent = 5,
+            completion_percent = 0,
             take_ownership = True,
           )
         except OSError as exc:
           print(format(msg('msg.unable_to_start_tor', error = exc), *ERROR_OUTPUT))
           sys.exit(1)
 
-  control_port = (args.control_address, args.control_port)
+  control_port = (args.control_address, args.control_port if args.control_port else 'default')  # type: Tuple[str, Union[int, str]]
   control_socket = args.control_socket
 
   # If the user explicitely specified an endpoint then just try to connect to





More information about the tor-commits mailing list