summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorJeff Cohen <jeffc@jolt-lang.org>2005-01-01 22:54:05 +0000
committerJeff Cohen <jeffc@jolt-lang.org>2005-01-01 22:54:05 +0000
commitb90c31fb4902472cdfe3c2fc483078193538b828 (patch)
tree8d7f4dc9f598667fb7c493b091882f35b149bceb /llvm/lib
parente98c7b6f2642a1d753bbba958892b7ffea608ecf (diff)
downloadbcm5719-llvm-b90c31fb4902472cdfe3c2fc483078193538b828.tar.gz
bcm5719-llvm-b90c31fb4902472cdfe3c2fc483078193538b828.zip
Add functions for determining if the stdin/out/err is connected to a
console or not. llvm-svn: 19236
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/System/Win32/Process.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/System/Win32/Process.cpp b/llvm/lib/System/Win32/Process.cpp
index 10fec05cb3d..dc4664109de 100644
--- a/llvm/lib/System/Win32/Process.cpp
+++ b/llvm/lib/System/Win32/Process.cpp
@@ -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 @@ void Process::PreventCoreFiles() {
// 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
OpenPOWER on IntegriCloud