Make connecting to Tor CLI progress all display on the same line

This commit is contained in:
Micah Lee 2020-08-27 18:21:03 -04:00
parent 74a945620f
commit d4a362f189
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -374,7 +374,10 @@ class Onion(object):
summary = res_parts[4].split("=")[1] summary = res_parts[4].split("=")[1]
# "\033[K" clears the rest of the line # "\033[K" clears the rest of the line
print(f"Connecting to the Tor network: {progress}% - {summary}\033[K") print(
f"\rConnecting to the Tor network: {progress}% - {summary}\033[K",
end="",
)
if callable(tor_status_update_func): if callable(tor_status_update_func):
if not tor_status_update_func(progress, summary): if not tor_status_update_func(progress, summary):
@ -552,8 +555,11 @@ class Onion(object):
# Do the versions of stem and tor that I'm using support stealth onion services? # Do the versions of stem and tor that I'm using support stealth onion services?
try: try:
res = self.c.create_ephemeral_hidden_service( res = self.c.create_ephemeral_hidden_service(
{1: 1}, basic_auth={"onionshare": None}, await_publication=False, {1: 1},
key_type="NEW",key_content="RSA1024" basic_auth={"onionshare": None},
await_publication=False,
key_type="NEW",
key_content="RSA1024",
) )
tmp_service_id = res.service_id tmp_service_id = res.service_id
self.c.remove_ephemeral_hidden_service(tmp_service_id) self.c.remove_ephemeral_hidden_service(tmp_service_id)