How to use the terminado.management.TermManagerBase function in terminado

To help you get started, we’ve selected a few terminado examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spyder-ide / spyder-terminal / spyder_terminal / server / logic / term_manager.py View on Github external
"""
        minrows = mincols = 10001
        if rows is not None and rows < minrows:
            minrows = rows
        if cols is not None and cols < mincols:
            mincols = cols

        if minrows == 10001 or mincols == 10001:
            return

        rows, cols = self.ptyproc.getwinsize()
        if (rows, cols) != (minrows, mincols):
            self.ptyproc.setwinsize(minrows, mincols)


class TermManager(TermManagerBase):
    """Wrapper around pexpect to execute local commands."""

    def __init__(self, shell_command, **kwargs):
        """Create a new terminal handler instance."""
        super().__init__(shell_command, **kwargs)
        self.consoles = {}

    def new_terminal(self, **options):
        """Make a new terminal, return a :class:`PtyReader` instance."""
        tty = super().new_terminal(**options)
        return PtyReader(tty.ptyproc)

    @tornado.gen.coroutine
    def client_disconnected(self, pid, socket):
        """Send terminal SIGHUP when client disconnects."""
        self.log.info("Websocket closed, sending SIGHUP to terminal.")

terminado

Tornado websocket backend for the Xterm.js Javascript terminal emulator library.

BSD-2-Clause
Latest version published 8 months ago

Package Health Score

86 / 100
Full package analysis

Similar packages