mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-22 16:28:19 +02:00
Framework for testing with external programs via a PTY
This commit is contained in:
@@ -9,7 +9,7 @@ import os
|
||||
import re
|
||||
import string
|
||||
import sys
|
||||
from contextlib import suppress
|
||||
from contextlib import contextmanager, suppress
|
||||
from functools import lru_cache
|
||||
from time import monotonic
|
||||
from typing import (
|
||||
@@ -501,6 +501,21 @@ class TTYIO:
|
||||
break
|
||||
|
||||
|
||||
@contextmanager
|
||||
def no_echo(fd: int = -1) -> Generator[None, None, None]:
|
||||
import termios
|
||||
if fd < 0:
|
||||
fd = sys.stdin.fileno()
|
||||
old = termios.tcgetattr(fd)
|
||||
new = termios.tcgetattr(fd)
|
||||
new[3] = new[3] & ~termios.ECHO
|
||||
try:
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, new)
|
||||
yield
|
||||
finally:
|
||||
termios.tcsetattr(fd, termios.TCSADRAIN, old)
|
||||
|
||||
|
||||
def natsort_ints(iterable: Iterable[str]) -> List[str]:
|
||||
|
||||
def convert(text: str) -> Union[int, str]:
|
||||
|
||||
Reference in New Issue
Block a user