2018-03-23 14:27:42 +00:00
|
|
|
from tornado.ioloop import IOLoop
|
|
|
|
|
|
|
|
from tfw.components.source_code_event_handler import SourceCodeEventHandler
|
|
|
|
from tfw.components.terminado_event_handler import TerminadoEventHandler
|
|
|
|
from tfw.components.process_managing_event_handler import ProcessManagingEventHandler
|
2018-03-25 14:34:31 +00:00
|
|
|
from tfw.config import TFWENV
|
2018-03-23 14:27:42 +00:00
|
|
|
from tfw.config.logs import logging
|
|
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
2018-03-25 14:34:31 +00:00
|
|
|
ide = SourceCodeEventHandler(key='webide', directory=TFWENV.WEBIDE_WD, exclude=['__pycache__'])
|
2018-03-23 14:27:42 +00:00
|
|
|
terminado = TerminadoEventHandler(key='shell')
|
|
|
|
terminado.historymonitor.subscribe_callback(callback=lambda hist: log.debug('User executed command: "{}"'.format(hist[-1])))
|
|
|
|
processmanager = ProcessManagingEventHandler(key='processmanager', dirmonitor=ide.monitor)
|
|
|
|
|
|
|
|
eventhandlers = {ide, terminado, processmanager}
|
|
|
|
try:
|
|
|
|
IOLoop.instance().start()
|
|
|
|
finally:
|
|
|
|
for eh in eventhandlers: eh.cleanup()
|