How to use the terminado.NamedTermManager 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 mattvonrocketstein / smash / smashlib / ipy3x / html / terminal / __init__.py View on Github external
def initialize(webapp):
    shell = os.environ.get('SHELL', 'sh')
    terminal_manager = webapp.settings[
        'terminal_manager'] = NamedTermManager(shell_command=[shell])
    base_url = webapp.settings['base_url']
    handlers = [
        (ujoin(base_url, r"/terminals/(\w+)"), TerminalHandler),
        (ujoin(base_url, r"/terminals/websocket/(\w+)"), TermSocket,
         {'term_manager': terminal_manager}),
        (ujoin(base_url, r"/api/terminals"), api_handlers.TerminalRootHandler),
        (ujoin(base_url, r"/api/terminals/(\w+)"),
         api_handlers.TerminalHandler),
    ]
    webapp.add_handlers(".*$", handlers)
github jupyter / notebook / notebook / terminal / __init__.py View on Github external
def initialize(webapp, notebook_dir, connection_url, settings):
    if os.name == 'nt':
        default_shell = 'powershell.exe'
    else:
        default_shell = which('sh')
    shell = settings.get('shell_command',
        [os.environ.get('SHELL') or default_shell]
    )
    # Enable login mode - to automatically source the /etc/profile script
    if os.name != 'nt':
        shell.append('-l')
    terminal_manager = webapp.settings['terminal_manager'] = NamedTermManager(
        shell_command=shell,
        extra_env={'JUPYTER_SERVER_ROOT': notebook_dir,
                   'JUPYTER_SERVER_URL': connection_url,
                   },
    )
    terminal_manager.log = app_log
    base_url = webapp.settings['base_url']
    handlers = [
        (ujoin(base_url, r"/terminals/(\w+)"), TerminalHandler),
        (ujoin(base_url, r"/terminals/websocket/(\w+)"), TermSocket,
             {'term_manager': terminal_manager}),
        (ujoin(base_url, r"/api/terminals"), api_handlers.TerminalRootHandler),
        (ujoin(base_url, r"/api/terminals/(\w+)"), api_handlers.TerminalHandler),
    ]
    webapp.add_handlers(".*$", handlers)

terminado

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

BSD-2-Clause
Latest version published 9 months ago

Package Health Score

86 / 100
Full package analysis

Similar packages