fix aria2 process killing completely (cross-platform)

This commit is contained in:
Vxrtrauter
2025-10-12 01:07:53 +02:00
parent f358d5462f
commit 0537bc23e3
4 changed files with 15 additions and 3 deletions
+14 -1
View File
@@ -1,14 +1,27 @@
from core.utils.data.state import state
import threading
import psutil
import sys
shutdown_event = threading.Event()
def kill_aria2server():
if sys.platform.startswith("win"):
process = "aria2c.exe"
else:
process = "aria2c"
if state.aria2process:
state.aria2process.kill()
if state.debug:
print("\nKilled Aria2")
print("Killed Aria2")
for proc in psutil.process_iter():
if proc.name() == process:
proc.kill()
if state.debug:
print("Killed Aria2c")
def closehelper():
-1
View File
@@ -13,7 +13,6 @@ def download_selected(item, posts, post_titles):
print(f"network {item.text()}")
run_thread(threading.Thread(target=run_download, args=(item.text(), posts, post_titles)))
else:
if state.debug:
print("No item selected for download.")
-1
View File
@@ -40,7 +40,6 @@ if __name__ == "__main__":
print("Starting Aria2 Server")
state.aria2process = run_aria2server()
signal.signal(signal.SIGINT, keyboardinterrupthandler)
atexit.register(kill_aria2server)
run_thread(threading.Thread(target=send_notification, args=(shutdown_event,), daemon=True))
if state.debug:
print("Launching GUI")
+1
View File
@@ -7,3 +7,4 @@ pyinstaller==6.15.0
pyqtdarktheme==0.1.7
aiohttp==3.13.0
plyer==2.1.0
psutil==7.1.0