Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""Term manager.""" import os import time import signal import hashlib import tornado.web import tornado.gen import tornado.ioloop from terminado.management import TermManagerBase, PtyWithClients from urllib.parse import unquote WINDOWS = os.name == 'nt' class PtyReader(PtyWithClients): """Wrapper around PtyWithClients.""" def resize_to_smallest(self, rows, cols): """Set the terminal size to that of the smallest client dimensions. A terminal not using the full space available is much nicer than a terminal trying to use more than the available space, so we keep it sized to the smallest client. """ 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: