Merge pull request #1173 from micahflee/1165_cli_tor_connection

Make connecting to Tor CLI progress all display on the same line
This commit is contained in:
Micah Lee 2020-08-27 15:58:35 -07:00 committed by GitHub
commit 04c8592765
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -374,7 +374,10 @@ class Onion(object):
summary = res_parts[4].split("=")[1]
# "\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 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?
try:
res = self.c.create_ephemeral_hidden_service(
{1: 1}, basic_auth={"onionshare": None}, await_publication=False,
key_type="NEW",key_content="RSA1024"
{1: 1},
basic_auth={"onionshare": None},
await_publication=False,
key_type="NEW",
key_content="RSA1024",
)
tmp_service_id = res.service_id
self.c.remove_ephemeral_hidden_service(tmp_service_id)