diff options
| author | Karen Tracey <kmtracey@gmail.com> | 2011-03-24 12:36:33 +0000 |
|---|---|---|
| committer | Karen Tracey <kmtracey@gmail.com> | 2011-03-24 12:36:33 +0000 |
| commit | 3e7ce3c750f05948615474e3f1b6e98ceb35fb75 (patch) | |
| tree | 683786ddcf8aa115649a036c622732aff15b43b0 /django/utils/autoreload.py | |
| parent | f3f1983f30802c20a19c1e847aee8cd5e69826a8 (diff) | |
Ensure stdin is a tty before handing it to termios, so as to prevent prolems when running under IDEs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15911 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/utils/autoreload.py')
| -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() |
