Author: kmtracey
Date: 2011-04-16 21:12:01 -0700 (Sat, 16 Apr 2011)
New Revision: 16029

Modified:
   django/branches/releases/1.3.X/django/utils/autoreload.py
Log:
[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.

Modified: django/branches/releases/1.3.X/django/utils/autoreload.py
===================================================================
--- django/branches/releases/1.3.X/django/utils/autoreload.py   2011-04-16 
18:43:01 UTC (rev 16028)
+++ django/branches/releases/1.3.X/django/utils/autoreload.py   2011-04-17 
04:12:01 UTC (rev 16029)
@@ -73,11 +73,12 @@
 
 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()

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to