mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 21:01:31 +00:00
Implement simple pty writing API
This commit is contained in:
parent
c4c07a4c85
commit
4873bbf421
@ -10,9 +10,13 @@ class TerminadoEventHandler(TriggerlessEventHandler):
|
||||
super().__init__(key)
|
||||
self.working_directory = tfwenv.TERMINADO_DIR
|
||||
self.terminado_server = TerminadoMiniServer('/terminal', tfwenv.TERMINADO_PORT, tfwenv.TERMINADO_WD, ['bash'])
|
||||
self.commands = {'write': self.write}
|
||||
self.terminado_server.listen()
|
||||
|
||||
def handle_event(self, key, data_json):
|
||||
log.debug('TerminadoEventHandler received event for key {}'.format(key))
|
||||
self.terminado_server.pty.write('echo cica\n')
|
||||
# TODO: design & implement pty.write API
|
||||
log.debug('TerminadoEventHandler received event: {}'.format(data_json))
|
||||
data = data_json['data']
|
||||
self.commands[data['command']](data)
|
||||
|
||||
def write(self, data):
|
||||
self.terminado_server.pty.write(data['shellcmd'])
|
||||
|
Loading…
Reference in New Issue
Block a user