Exemple #1
0
class TelnetFrontend(Frontend):

    def eval(self, *args, **kw):
        try:
            return super(TelnetFrontend, self).eval(*args, **kw) + u'\n'
        except Exception as e:
            error = lispify(e, typecode='error')
            return unicode(lispify([error])) + u'\n'

    def __init__(self, *args, **kwargs):
        super(TelnetFrontend, self).__init__(*args, **kwargs)
        self.srv = TelnetServer(('0.0.0.0', 8023), self.eval)

    def run(self):
        self.log().info("Running telnet server...")
        self.srv.serve_forever()

    @provide()
    def quit(self, status=0):
        self.log().info("Exiting with status %d" % status)
        exit(status)
Exemple #2
0
 def __init__(self, *args, **kwargs):
     super(TelnetFrontend, self).__init__(*args, **kwargs)
     self.srv = TelnetServer(('0.0.0.0', 8023), self.eval)