Commits

Anonymous committed 1a86bb3

[1.2.X] Fixed #15565: Ensure terminal echo is on after reloader reloads (something turns it off on some systems if reload happens while at a pdb prompt). Thanks for the report zimnyx.

r15883 from trunk.

  • Participants
  • Parent commits 3bf2b16
  • Branches releases/1.2.X

Comments (0)

Files changed (1)

File django/utils/autoreload.py

 except ImportError:
     pass
 
+try:
+    import termios
+except ImportError:
+    termios = None
 
 RUN_RELOADER = True
 
             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