mirror of
https://github.com/django/django.git
synced 2025-08-08 10:59:17 +00:00
Refs #30323 -- Simplified utils.autoreload.ensure_echo_on().
This commit is contained in:
parent
ed880d92b5
commit
b5259ab780
@ -78,19 +78,22 @@ def raise_last_exception():
|
|||||||
|
|
||||||
|
|
||||||
def ensure_echo_on():
|
def ensure_echo_on():
|
||||||
if termios:
|
"""
|
||||||
fd = sys.stdin
|
Ensure that echo mode is enabled. Some tools such as PDB disable
|
||||||
if fd.isatty():
|
it which causes usability issues after reload.
|
||||||
attr_list = termios.tcgetattr(fd)
|
"""
|
||||||
if not attr_list[3] & termios.ECHO:
|
if not termios or not sys.stdin.isatty():
|
||||||
attr_list[3] |= termios.ECHO
|
return
|
||||||
if hasattr(signal, 'SIGTTOU'):
|
attr_list = termios.tcgetattr(sys.stdin)
|
||||||
old_handler = signal.signal(signal.SIGTTOU, signal.SIG_IGN)
|
if not attr_list[3] & termios.ECHO:
|
||||||
else:
|
attr_list[3] |= termios.ECHO
|
||||||
old_handler = None
|
if hasattr(signal, 'SIGTTOU'):
|
||||||
termios.tcsetattr(fd, termios.TCSANOW, attr_list)
|
old_handler = signal.signal(signal.SIGTTOU, signal.SIG_IGN)
|
||||||
if old_handler is not None:
|
else:
|
||||||
signal.signal(signal.SIGTTOU, old_handler)
|
old_handler = None
|
||||||
|
termios.tcsetattr(sys.stdin, termios.TCSANOW, attr_list)
|
||||||
|
if old_handler is not None:
|
||||||
|
signal.signal(signal.SIGTTOU, old_handler)
|
||||||
|
|
||||||
|
|
||||||
def iter_all_python_module_files():
|
def iter_all_python_module_files():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user