diff --git a/lib/System/Win32/Process.cpp b/lib/System/Win32/Process.cpp index 10fec05cb3d..dc4664109de 100644 --- a/lib/System/Win32/Process.cpp +++ b/lib/System/Win32/Process.cpp @@ -14,6 +14,7 @@ #include "Win32.h" #include #include +#include #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 diff --git a/lib/System/Win32/Process.inc b/lib/System/Win32/Process.inc index 10fec05cb3d..dc4664109de 100644 --- a/lib/System/Win32/Process.inc +++ b/lib/System/Win32/Process.inc @@ -14,6 +14,7 @@ #include "Win32.h" #include #include +#include #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