diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 51aaccdc8e62f..e5a421e586ca0 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -42,6 +42,10 @@ except ImportError: pass +try: + import termios +except ImportError: + termios = None RUN_RELOADER = True @@ -67,7 +71,16 @@ def code_changed(): return True return False +def ensure_echo_on(): + if termios: + fd = sys.stdin.fileno() + attr_list = termios.tcgetattr(fd) + if not attr_list[3] & termios.ECHO: + attr_list[3] |= termios.ECHO + termios.tcsetattr(fd, termios.TCSANOW, attr_list) + def reloader_thread(): + ensure_echo_on() while RUN_RELOADER: if code_changed(): sys.exit(3) # force reload