Ensure that echo mode is enabled. Some tools such as PDB disable it which causes usability issues after reload.
()
| 91 | |
| 92 | |
| 93 | def ensure_echo_on(): |
| 94 | """ |
| 95 | Ensure that echo mode is enabled. Some tools such as PDB disable |
| 96 | it which causes usability issues after reload. |
| 97 | """ |
| 98 | if not termios or not sys.stdin.isatty(): |
| 99 | return |
| 100 | attr_list = termios.tcgetattr(sys.stdin) |
| 101 | if not attr_list[3] & termios.ECHO: |
| 102 | attr_list[3] |= termios.ECHO |
| 103 | if hasattr(signal, "SIGTTOU"): |
| 104 | old_handler = signal.signal(signal.SIGTTOU, signal.SIG_IGN) |
| 105 | else: |
| 106 | old_handler = None |
| 107 | termios.tcsetattr(sys.stdin, termios.TCSANOW, attr_list) |
| 108 | if old_handler is not None: |
| 109 | signal.signal(signal.SIGTTOU, old_handler) |
| 110 | |
| 111 | |
| 112 | def iter_all_python_module_files(): |