Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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
kmtracey committed Mar 19, 2011
1 parent 52e8107 commit f9f2f4b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions django/utils/autoreload.py
Expand Up @@ -42,6 +42,10 @@
except ImportError:
pass

try:
import termios
except ImportError:
termios = None

RUN_RELOADER = True

Expand All @@ -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
Expand Down

0 comments on commit f9f2f4b

Please sign in to comment.