def on_data(fd, events): try: data = os.read(fd, 1024) out_stream.send(format_zmq_message(_id, 'output', data)) os.write(pty.STDOUT_FILENO, data) except OSError: ioloop.IOLoop.instance().stop()
def write_terminal(self, terminal_id, command, data): logging.debug('[terminal %s] <- Command "%s" of len %d bytes' % (terminal_id, command, len(data))) self.socket_out.send(format_zmq_message(terminal_id, command, data))