fix aria2 window showing up for binaries, added error handling for aria2 killing

This commit is contained in:
Vxrtrauter
2025-10-12 02:13:18 +02:00
parent e41b142023
commit d9314c979e
2 changed files with 16 additions and 8 deletions
+7 -1
View File
@@ -3,6 +3,7 @@ import subprocess
from core.utils.data.state import state from core.utils.data.state import state
from plyer import notification from plyer import notification
import time import time
import sys
def run_aria2p(): def run_aria2p():
@@ -33,7 +34,12 @@ def aria2server():
"-s", str(state.aria2_threads), "-s", str(state.aria2_threads),
] ]
aria2server = subprocess.Popen(cmd) aria2server = subprocess.Popen(
cmd,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
creationflags=subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0
)
return aria2server return aria2server
def dlprogress(): def dlprogress():
+8 -6
View File
@@ -17,12 +17,14 @@ def kill_aria2server():
if state.debug: if state.debug:
print("Killed Aria2") print("Killed Aria2")
for proc in psutil.process_iter(): try:
if proc.name() == process: for proc in psutil.process_iter():
proc.kill() if proc.name() == process:
if state.debug: proc.kill()
print("Killed Aria2c") if state.debug:
print("Killed Aria2c")
except psutil.NoSuchProcess:
pass
def closehelper(): def closehelper():
shutdown_event.set() shutdown_event.set()