Make onionshare tor process detection work in Windows

This commit is contained in:
Micah Lee 2020-11-17 18:46:22 -08:00
parent 4085814a33
commit 65dff09a68
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -238,7 +238,7 @@ class Onion(object):
# If there is an existing OnionShare tor process, kill it
for proc in psutil.process_iter(["pid", "name", "username"]):
if proc.username() == getpass.getuser():
try:
cmdline = proc.cmdline()
if (
cmdline[0] == self.tor_path
@ -252,6 +252,9 @@ class Onion(object):
)
proc.terminate()
proc.wait()
break
except:
pass
if self.common.platform == "Windows" or self.common.platform == "Darwin":
# Windows doesn't support unix sockets, so it must use a network port.