mirror of
https://github.com/onionshare/onionshare.git
synced 2025-07-30 18:09:01 -04:00
Open share tab if filenames are passed; and when detecting existing onionshare-gui processes, ignore zombies
This commit is contained in:
parent
7e06872a39
commit
e316af0e11
1 changed files with 6 additions and 1 deletions
|
@ -131,7 +131,7 @@ def main():
|
||||||
if proc.info["pid"] == os.getpid():
|
if proc.info["pid"] == os.getpid():
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if proc.info["name"] == "onionshare-gui":
|
if proc.info["name"] == "onionshare-gui" and proc.status() != "zombie":
|
||||||
existing_pid = proc.info["pid"]
|
existing_pid = proc.info["pid"]
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
|
@ -140,6 +140,7 @@ def main():
|
||||||
if (
|
if (
|
||||||
os.path.basename(proc.info["cmdline"][0]).lower() == "python"
|
os.path.basename(proc.info["cmdline"][0]).lower() == "python"
|
||||||
and os.path.basename(proc.info["cmdline"][1]) == "onionshare-gui"
|
and os.path.basename(proc.info["cmdline"][1]) == "onionshare-gui"
|
||||||
|
and proc.status() != "zombie"
|
||||||
):
|
):
|
||||||
existing_pid = proc.info["pid"]
|
existing_pid = proc.info["pid"]
|
||||||
break
|
break
|
||||||
|
@ -161,6 +162,10 @@ def main():
|
||||||
# Launch the gui
|
# Launch the gui
|
||||||
main_window = MainWindow(common, filenames)
|
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
|
# Clean up when app quits
|
||||||
def shutdown():
|
def shutdown():
|
||||||
main_window.cleanup()
|
main_window.cleanup()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue