Open share tab if filenames are passed; and when detecting existing onionshare-gui processes, ignore zombies

This commit is contained in:
Micah Lee 2019-11-28 13:33:56 -08:00
parent 7e06872a39
commit e316af0e11
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -131,7 +131,7 @@ def main():
if proc.info["pid"] == os.getpid():
continue
if proc.info["name"] == "onionshare-gui":
if proc.info["name"] == "onionshare-gui" and proc.status() != "zombie":
existing_pid = proc.info["pid"]
break
else:
@ -140,6 +140,7 @@ def main():
if (
os.path.basename(proc.info["cmdline"][0]).lower() == "python"
and os.path.basename(proc.info["cmdline"][1]) == "onionshare-gui"
and proc.status() != "zombie"
):
existing_pid = proc.info["pid"]
break
@ -161,6 +162,10 @@ def main():
# Launch the gui
main_window = MainWindow(common, filenames)
# If filenames were passed in, open them in a tab
if filenames:
main_window.tabs.new_share_tab(filenames)
# Clean up when app quits
def shutdown():
main_window.cleanup()