set process/thread titles for decky and plugins

sadly requires the `setproctitle` pypi module because python doesn't have a builtin to do this :/
This commit is contained in:
AAGaming
2024-07-03 20:43:08 -04:00
parent 83972972f3
commit f5eba51c52
5 changed files with 120 additions and 12 deletions
@@ -7,6 +7,7 @@ from sys import exit, path as syspath, modules as sysmodules
from traceback import format_exc
from asyncio import (get_event_loop, new_event_loop,
set_event_loop, sleep)
from setproctitle import setproctitle, setthreadtitle
from .messages import SocketResponseDict, SocketMessageType
from ..localplatform.localsocket import LocalSocket
@@ -48,6 +49,9 @@ class SandboxedPlugin:
signal(SIGINT, SIG_IGN)
signal(SIGTERM, SIG_IGN)
setproctitle(f"{self.name} ({self.file})")
setthreadtitle(self.name)
set_event_loop(new_event_loop())
if self.passive:
return