diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2011-04-17 04:12:01 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2011-04-17 04:12:01 +0000 |
| commit | cdd75e078ab548a3690113b3bdaeda47decba92a (patch) | |
| tree | 3a6ad8a00105ff4ca75fd55302180b586a76b58d | |
| parent | 79bb9c145620ad6b4b424e2390c6e0b6905c122b (diff) | |
[1.3.X] Ensure stdin is a tty before handing it to termios, so as to prevent prolems when running under IDEs.
Backport of [15911] from trunk.
git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16029 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/utils/autoreload.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py index e5a421e586..ffa75e2c4f 100644 --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -73,11 +73,12 @@ def code_changed(): 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) + fd = sys.stdin + if fd.isatty(): + 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() |
