mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
31 lines
691 B
Python
31 lines
691 B
Python
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("Killed Aria2")
|
|
|
|
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()
|
|
kill_aria2server() |