[Twisted-Python] Screen clearing in the Manhole

Brian Costlow brian.costlow at gmail.com
Tue Aug 25 15:26:27 MDT 2015


As to where it happens, look at
twisted.conch.recvline.RecvLine.connectionMade() and
twisted.conch.insults.insults.TerminalProtocol.makeConnection()

You could step on the RecvLine. initializeScreen(), but I have no idea what
the side effects are. (And of course if you bypass all or part of it, even
if it works now, it's alway subject to future breakage.

On Tue, Aug 25, 2015 at 12:27 PM, Peter Westlake <peter.westlake at pobox.com>
wrote:

> I'm making a manhole service in the usual way:
>
>     class PF(ServerProtocol):
>         def protocolFactory(*a, **kw):
>             return manhole.Manhole(namespace)
>
>     realm = manhole_ssh.TerminalRealm()
>     realm.chainedProtocolFactory = PF
>     mh_portal = portal.Portal(realm)
>     mh_portal.registerChecker(checker)
>
>     manhole_service = TCPServer(0, manhole_ssh.ConchFactory(mh_portal))
>     manhole_service.startService()
>
> and I'd like to print a message when the terminal is opened. This change
> does it:
>
>     class PF(ServerProtocol):
>         def protocolFactory(*a, **kw):
>             class Manhole(manhole.Manhole):
>                 def connectionMade(self):
>                     super(Manhole, self).connectionMade()
>                     self.terminal.write('Hello')
>             return manhole.Manhole(namespace)
>
> and so does this version, which is better because
> t.c.i.i.ServerProtocol.connectionMade says it is the place to write
> messages:
>
>     class PF(ServerProtocol):
>         def protocolFactory(*a, **kw):
>             return manhole.Manhole(namespace)
>
>         def connectionMade(self):
>             ServerProtocol.connectionMade(self)
>             self.write('Hello')
>
> But in both cases, after the message the screen is cleared by what looks
> like a form feed, and another prompt is printed. So far I can't find where
> in the code this happens. Is there a way to print a message and not have it
> scrolled off the screen?
>
> Thanks,
>
> Peter.
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20150825/cf915b69/attachment-0002.html>


More information about the Twisted-Python mailing list