diff options
author | Karen Tracey <kmtracey@gmail.com> | 2011-03-19 22:13:35 +0000 |
---|---|---|
committer | Karen Tracey <kmtracey@gmail.com> | 2011-03-19 22:13:35 +0000 |
commit | f9f2f4b7ec62c75d55bd1240ae182615e62fbe64 (patch) | |
tree | 48be41f99072beceb794bee8db81b1349b57cb31 | |
parent | 52e81079bee761500c21c11fa3cabf9a8da1546f (diff) | |
download | django-f9f2f4b7ec62c75d55bd1240ae182615e62fbe64.tar.gz |
[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.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r-- | django/utils/autoreload.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index 51aaccdc8e..e5a421e586 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -42,6 +42,10 @@ try: 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 |