From 46cf7c5fd6768f94d8938458668672a54d710f6d Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Wed, 10 Nov 2010 08:37:47 +0000 Subject: [PATCH] Win32/Process.inc: [PR8527] Process::FileDescriptorIsDisplayed(fd) should not check by FILE_TYPE_CHAR. It must be better to check it with Console API. The special file "NUL" is FILE_TYPE_CHAR with GetFileType(h). It was treated as display device and discarding output to NUL had failed. (eg. opt -o nul) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118678 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/System/Win32/Process.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/System/Win32/Process.inc b/lib/System/Win32/Process.inc index feb0806116e..15b41f00eaf 100644 --- a/lib/System/Win32/Process.inc +++ b/lib/System/Win32/Process.inc @@ -132,7 +132,8 @@ bool Process::StandardErrIsDisplayed() { } bool Process::FileDescriptorIsDisplayed(int fd) { - return GetFileType((HANDLE)_get_osfhandle(fd)) == FILE_TYPE_CHAR; + DWORD Mode; // Unused + return (GetConsoleMode((HANDLE)_get_osfhandle(fd), &Mode) != 0); } unsigned Process::StandardOutColumns() {