Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[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
  • Loading branch information...
commit cdd75e078ab548a3690113b3bdaeda47decba92a 1 parent 79bb9c1
Karen Tracey authored April 17, 2011

Showing 1 changed file with 6 additions and 5 deletions. Show diff stats Hide diff stats

  1. 11  django/utils/autoreload.py
11  django/utils/autoreload.py
@@ -73,11 +73,12 @@ def code_changed():
73 73
 
74 74
 def ensure_echo_on():
75 75
     if termios:
76  
-        fd = sys.stdin.fileno()
77  
-        attr_list = termios.tcgetattr(fd)
78  
-        if not attr_list[3] & termios.ECHO:
79  
-            attr_list[3] |= termios.ECHO
80  
-            termios.tcsetattr(fd, termios.TCSANOW, attr_list)
  76
+        fd = sys.stdin
  77
+        if fd.isatty():
  78
+            attr_list = termios.tcgetattr(fd)
  79
+            if not attr_list[3] & termios.ECHO:
  80
+                attr_list[3] |= termios.ECHO
  81
+                termios.tcsetattr(fd, termios.TCSANOW, attr_list)
81 82
 
82 83
 def reloader_thread():
83 84
     ensure_echo_on()

0 notes on commit cdd75e0

Please sign in to comment.
Something went wrong with that request. Please try again.