Add example process with PipeIO event handlers

This commit is contained in:
Kristóf Tóth 2019-05-02 15:59:20 +02:00
parent e204cc7422
commit 31d8161379
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,24 @@
from signal import signal, SIGTERM, SIGINT
from tornado.ioloop import IOLoop
from tfw import EventHandlerBase
from tfw.components import PipeIOEventHandler
if __name__ == '__main__':
ide_pipeio = PipeIOEventHandler(
'ide',
'/tmp/ide_send',
'/tmp/ide_recv'
)
event_handlers = EventHandlerBase.get_local_instances()
def cleanup(sig, frame):
for eh in event_handlers:
eh.cleanup()
exit(0)
signal(SIGTERM, cleanup)
signal(SIGINT, cleanup)
IOLoop.instance().start()

View File

@ -0,0 +1,4 @@
[program:pipe_io_main]
user=root
directory=%(ENV_TFW_EHMAIN_DIR)s
command=python3 pipe_io_main.py