Added args handler, made IPC singleton

This commit is contained in:
2023-03-27 21:25:54 -05:00
parent ef03030c88
commit b4120bdca4
6 changed files with 28 additions and 6 deletions

View File

@@ -8,11 +8,11 @@ from multiprocessing.connection import Listener
# Lib imports
# Application imports
from .singleton import Singleton
class IPCServer:
class IPCServer(Singleton):
""" Create a listener so that other {app_name} instances send requests back to existing instance. """
def __init__(self, ipc_address: str = '127.0.0.1', conn_type: str = "socket"):
self.is_ipc_alive = False
@@ -77,6 +77,11 @@ class IPCServer:
if file:
event_system.emit("handle_file_from_ipc", file)
if "DIR|" in msg:
file = msg.split("DIR|")[1].strip()
if file:
event_system.emit("handle_dir_from_ipc", file)
conn.close()
break

View File

@@ -5,6 +5,7 @@
# Application imports
class SingletonError(Exception):
pass