Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.2.X] Fixed #15565: Ensure terminal echo is on after reloader reloa…

…ds (something turns it off on some systems if reload happens while at a pdb prompt). Thanks for the report zimnyx.

r15883 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f9f2f4b7ec62c75d55bd1240ae182615e62fbe64 1 parent 52e8107
Karen Tracey authored March 19, 2011

Showing 1 changed file with 13 additions and 0 deletions. Show diff stats Hide diff stats

  1. 13  django/utils/autoreload.py
13  django/utils/autoreload.py
@@ -42,6 +42,10 @@
42 42
 except ImportError:
43 43
     pass
44 44
 
  45
+try:
  46
+    import termios
  47
+except ImportError:
  48
+    termios = None
45 49
 
46 50
 RUN_RELOADER = True
47 51
 
@@ -67,7 +71,16 @@ def code_changed():
67 71
             return True
68 72
     return False
69 73
 
  74
+def ensure_echo_on():
  75
+    if termios:
  76
+        fd = sys.stdin.fileno()
  77
+        attr_list = termios.tcgetattr(fd)
  78
+        if not attr_list[3] & termios.ECHO:
  79
+            attr_list[3] |= termios.ECHO
  80
+            termios.tcsetattr(fd, termios.TCSANOW, attr_list)
  81
+
70 82
 def reloader_thread():
  83
+    ensure_echo_on()
71 84
     while RUN_RELOADER:
72 85
         if code_changed():
73 86
             sys.exit(3) # force reload

0 notes on commit f9f2f4b

Please sign in to comment.
Something went wrong with that request. Please try again.