Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[1.2.X] Ensure stdin is a tty before handing it to termios, so as to …

…prevent prolems when running under IDEs.

r15911 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15912 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 1dc518555b137beb7b3ffabc8d0e68edd2b27e61 1 parent c5b476e
Karen Tracey kmtracey authored
Showing with 6 additions and 5 deletions.
  1. +6 −5 django/utils/autoreload.py
11 django/utils/autoreload.py
View
@@ -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.