Revision: 7c9560f07f9b
Branch:   default
Author:   Robot Framework Developers <[email protected]>
Date:     Wed Sep 19 06:49:08 2012
Log:      working isatty implementation for ipy on windows
http://code.google.com/p/robotframework/source/detail?r=7c9560f07f9b

Modified:
 /src/robot/utils/misc.py

=======================================
--- /src/robot/utils/misc.py    Wed Sep 19 05:30:15 2012
+++ /src/robot/utils/misc.py    Wed Sep 19 06:49:08 2012
@@ -113,5 +113,13 @@

 else:

+    from ctypes import windll
+
+    _HANDLE_IDS = {sys.__stdout__ : -11, sys.__stderr__ : -12}
+    _CONSOLE_TYPE = 2
+
     def isatty(stream):
-        return True
+        if stream not in _HANDLE_IDS:
+            return False
+        handle = windll.kernel32.GetStdHandle(_HANDLE_IDS[stream])
+        return windll.kernel32.GetFileType(handle) == _CONSOLE_TYPE

Reply via email to