def _ensure_echo_on(): # pragma: no cover
if not sys.stdin.isatty():
return None
file_descriptor_attrs = termios.tcgetattr(sys.stdin)
_, _, _, lflag, _, _, _ = file_descriptor_attrs
if not lflag & termios.ECHO:
lflag |= termios.ECHO
try:
old_sig_handler = signal.signal(signal.SIGTTOU, signal.SIG_IGN)
except AttributeError:
old_sig_handler = None
termios.tcsetattr(sys.stdin, termios.TCSANOW, file_descriptor_attrs)
if old_sig_handler is not None:
signal.signal(signal.SIGTTOU, old_sig_handler)
评论列表
文章目录