Add kill_childs to GUI

This commit is contained in:
Orsiris de Jong 2023-12-28 00:32:56 +01:00
parent ca62614f8b
commit 14d950427e

View file

@ -21,6 +21,7 @@ import dateutil
from time import sleep from time import sleep
from ruamel.yaml.comments import CommentedMap from ruamel.yaml.comments import CommentedMap
import atexit import atexit
from ofunctions.process import kill_childs
from ofunctions.threading import threaded from ofunctions.threading import threaded
from ofunctions.misc import BytesConverter from ofunctions.misc import BytesConverter
import PySimpleGUI as sg import PySimpleGUI as sg
@ -720,6 +721,11 @@ def main_gui(viewer_mode=False):
npbackup.common.execution_logs, npbackup.common.execution_logs,
datetime.utcnow(), datetime.utcnow(),
) )
# kill_childs normally would not be necessary, but let's just be foolproof here (kills restic subprocess in all cases)
atexit.register(
kill_childs,
os.getpid(),
)
try: try:
_main_gui(viewer_mode=viewer_mode) _main_gui(viewer_mode=viewer_mode)
sys.exit(logger.get_worst_logger_level()) sys.exit(logger.get_worst_logger_level())