mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-04 17:59:43 +02:00
fix aria2 window showing up for binaries, added error handling for aria2 killing
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user