From d9314c979e27a2530f10432505d1fae1c053fb27 Mon Sep 17 00:00:00 2001 From: Vxrtrauter Date: Sun, 12 Oct 2025 02:13:18 +0200 Subject: [PATCH] fix aria2 window showing up for binaries, added error handling for aria2 killing --- core/network/aria2_integration.py | 8 +++++++- core/utils/general/shutdown.py | 16 +++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/core/network/aria2_integration.py b/core/network/aria2_integration.py index b9152b2..49cd7e5 100644 --- a/core/network/aria2_integration.py +++ b/core/network/aria2_integration.py @@ -3,6 +3,7 @@ import subprocess from core.utils.data.state import state from plyer import notification import time +import sys def run_aria2p(): @@ -33,7 +34,12 @@ def aria2server(): "-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 def dlprogress(): diff --git a/core/utils/general/shutdown.py b/core/utils/general/shutdown.py index 3701702..38bf9fe 100644 --- a/core/utils/general/shutdown.py +++ b/core/utils/general/shutdown.py @@ -16,13 +16,15 @@ def kill_aria2server(): state.aria2process.kill() if state.debug: print("Killed Aria2") - - for proc in psutil.process_iter(): - if proc.name() == process: - proc.kill() - if state.debug: - print("Killed Aria2c") - + + try: + for proc in psutil.process_iter(): + if proc.name() == process: + proc.kill() + if state.debug: + print("Killed Aria2c") + except psutil.NoSuchProcess: + pass def closehelper(): shutdown_event.set()