Delegate ownership of terminado server to TerminadoEventHandler

This commit is contained in:
Kristóf Tóth 2018-03-02 16:23:19 +01:00
parent 338e690842
commit cc2c6009dd
2 changed files with 6 additions and 6 deletions

View File

@ -1,16 +1,16 @@
from tfw.components.terminado_mini_server import TerminadoMiniServer
from tfw.event_handler_base import TriggerlessEventHandler
from tfw.components.mixins import SupervisorMixin
from tfw.config import tfwenv
from tfw.config.logs import logging
log = logging.getLogger(__name__)
class TerminadoEventHandler(TriggerlessEventHandler, SupervisorMixin):
def __init__(self, key, process_name):
class TerminadoEventHandler(TriggerlessEventHandler):
def __init__(self, key):
super().__init__(key)
self.working_directory = tfwenv.TERMINADO_DIR
self.process_name = process_name
self.start_process(self.process_name)
self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash'])
self.terminado_server.listen()
def handle_event(self, key, data_json):
log.debug('TerminadoEventHandler received event for key {}'.format(key))

View File

@ -8,7 +8,7 @@ from tfw.config import tfwenv
if __name__ == '__main__':
ide = SourceCodeEventHandler('webide', tfwenv.WEBIDE_WD)
terminado = TerminadoEventHandler('terminado', 'terminado')
terminado = TerminadoEventHandler('terminado')
processmanager = ProcessManagingEventHandler('processmanager', ide.monitor)
eventhandlers = {ide, terminado, processmanager}