Skip to content

Commit

Permalink
Properly handle systemd signals
Browse files Browse the repository at this point in the history
  • Loading branch information
RodoMa92 committed Aug 28, 2024
1 parent 927f912 commit 0e6fe37
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/decky_loader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# Full imports
import multiprocessing
multiprocessing.freeze_support()
import signal
from asyncio import AbstractEventLoop, CancelledError, Task, all_tasks, current_task, gather, new_event_loop, set_event_loop, sleep
from logging import basicConfig, getLogger
from os import path
Expand Down Expand Up @@ -258,6 +259,11 @@ def main():
# Append the system and user python paths
sys.path.extend(get_system_pythonpaths())

#Catch a sigint (CTRL-C) coming from systemd and shut down gracefully
#TODO: Handle the Windows case in the future
if ON_LINUX:
signal.signal(signal.SIGINT, PluginManager.shutdown)

logger.info(f"Starting Decky version {get_loader_version()}")

loop = new_event_loop()
Expand Down

0 comments on commit 0e6fe37

Please sign in to comment.