Don't bother checking canRead() before calling getMagicNumber();
[oota-llvm.git] / lib / System / Win32 / Process.inc
index 97eba5808dfe30e69258295e574d593022d98fb6..feb0806116e46bbb1b545449227d436fd81f6aa9 100644 (file)
@@ -120,15 +120,19 @@ void Process::PreventCoreFiles() {
 }
 
 bool Process::StandardInIsUserInput() {
-  return GetFileType((HANDLE)_get_osfhandle(0)) == FILE_TYPE_CHAR;
+  return FileDescriptorIsDisplayed(0);
 }
 
 bool Process::StandardOutIsDisplayed() {
-  return GetFileType((HANDLE)_get_osfhandle(1)) == FILE_TYPE_CHAR;
+  return FileDescriptorIsDisplayed(1);
 }
 
 bool Process::StandardErrIsDisplayed() {
-  return GetFileType((HANDLE)_get_osfhandle(2)) == FILE_TYPE_CHAR;
+  return FileDescriptorIsDisplayed(2);
+}
+
+bool Process::FileDescriptorIsDisplayed(int fd) {
+  return GetFileType((HANDLE)_get_osfhandle(fd)) == FILE_TYPE_CHAR;
 }
 
 unsigned Process::StandardOutColumns() {
@@ -147,7 +151,7 @@ unsigned Process::StandardErrColumns() {
   return Columns;
 }
 
-// it always has colors
+// It always has colors.
 bool Process::StandardErrHasColors() {
   return StandardErrIsDisplayed();
 }
@@ -155,6 +159,7 @@ bool Process::StandardErrHasColors() {
 bool Process::StandardOutHasColors() {
   return StandardOutIsDisplayed();
 }
+
 namespace {
 class DefaultColors
 {