[llvm-commits] CVS: llvm/lib/System/Win32/Process.cpp

Jeff Cohen jeffc at jolt-lang.org
Sat Jan 1 14:54:15 PST 2005



Changes in directory llvm/lib/System/Win32:

Process.cpp updated: 1.6 -> 1.7
---
Log message:

Add functions for determining if the stdin/out/err is connected to a
console or not.

---
Diffs of the changes:  (+13 -0)

Index: llvm/lib/System/Win32/Process.cpp
diff -u llvm/lib/System/Win32/Process.cpp:1.6 llvm/lib/System/Win32/Process.cpp:1.7
--- llvm/lib/System/Win32/Process.cpp:1.6	Mon Dec 27 00:17:26 2004
+++ llvm/lib/System/Win32/Process.cpp	Sat Jan  1 16:54:05 2005
@@ -14,6 +14,7 @@
 #include "Win32.h"
 #include <psapi.h>
 #include <malloc.h>
+#include <io.h>
 
 #pragma comment(lib, "psapi.lib")
 
@@ -99,5 +100,17 @@
   // dialog box from coming up.  Or maybe not...
 }
 
+bool Process::StandardInIsUserInput() {
+  return GetFileType((HANDLE)_get_osfhandle(0)) == FILE_TYPE_CHAR;
+}
+
+bool Process::StandardOutIsDisplayed() {
+  return GetFileType((HANDLE)_get_osfhandle(1)) == FILE_TYPE_CHAR;
+}
+
+bool Process::StandardErrIsDisplayed() {
+  return GetFileType((HANDLE)_get_osfhandle(2)) == FILE_TYPE_CHAR;
+}
+
 }
 // vim: sw=2 smartindent smarttab tw=80 autoindent expandtab






More information about the llvm-commits mailing list