Skip to content

Commit f9f2f4b

Browse files
committed
[1.2.X] Fixed django#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. git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
1 parent 52e8107 commit f9f2f4b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

django/utils/autoreload.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
except ImportError:
4343
pass
4444

45+
try:
46+
import termios
47+
except ImportError:
48+
termios = None
4549

4650
RUN_RELOADER = True
4751

@@ -67,7 +71,16 @@ def code_changed():
6771
return True
6872
return False
6973

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+
7082
def reloader_thread():
83+
ensure_echo_on()
7184
while RUN_RELOADER:
7285
if code_changed():
7386
sys.exit(3) # force reload

0 commit comments

Comments
 (0)