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 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():
|
||||||
|
|||||||
@@ -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()
|
||||||
|
|||||||
Reference in New Issue
Block a user