Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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
  • Loading branch information...
commit 3e7ce3c750f05948615474e3f1b6e98ceb35fb75 1 parent f3f1983
@kmtracey kmtracey authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 django/utils/autoreload.py
View
11 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()
Please sign in to comment.
Something went wrong with that request. Please try again.