[llvm-commits] [llvm] r118678 - /llvm/trunk/lib/System/Win32/Process.inc

NAKAMURA Takumi geek4civic at gmail.com
Wed Nov 10 00:37:47 PST 2010


Author: chapuni
Date: Wed Nov 10 02:37:47 2010
New Revision: 118678

URL: http://llvm.org/viewvc/llvm-project?rev=118678&view=rev
Log:
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)

Modified:
    llvm/trunk/lib/System/Win32/Process.inc

Modified: llvm/trunk/lib/System/Win32/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Win32/Process.inc?rev=118678&r1=118677&r2=118678&view=diff
==============================================================================
--- llvm/trunk/lib/System/Win32/Process.inc (original)
+++ llvm/trunk/lib/System/Win32/Process.inc Wed Nov 10 02:37:47 2010
@@ -132,7 +132,8 @@
 }
 
 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() {





More information about the llvm-commits mailing list