From: Lars Christensen Date: 2008-06-21T23:25:28+09:00 Subject: [ruby-core:17367] Building on MinGW broken (patch for win32/win32.c) The change in r17376 to win32/win32.c breaks compilation on MinGW/MSYS. make.exe fails because miniruby.exe invokes it without a stdin/stdout. There is a couple of issues with the "CreateChild" function: * The function uses the bInheritHandle member of the SECURITY_ATTRIBUTES as input to CreateProcess's bInheritHandles parameter. These two have different meaning: The bInheritHandle in the SA determines if the newly created handle will be inherited. The CreateProcess argument "bInheritHandles" determines where the child actually inherits any handles. * The bInheritHandles argument must be TRUE if it child is to get any stdin/stdout/sterr through the STARTUPINFO structure (MSDN regarding the STARTF_USESTDHANDLES flag: "If this flag is specified [...] the function's bInheritHandles parameter must be set to TRUE."). Unless there is a reason not to, I suggest setting bInheritHandles to TRUE always, as it's the only way to give the child stdin/stdout/sterr. (To prevent other handles from being inherited, their SECURITY_ATTRIBUTES needs to be set properly). This resolves building on MinGW/MSYS. Index: win32/win32.c =================================================================== --- win32/win32.c (revision 17505) +++ win32/win32.c (working copy) @@ -988,7 +988,7 @@ RUBY_CRITICAL({ fRet = CreateProcess(shell, (char *)cmd, psa, psa, - psa->bInheritHandle, dwCreationFlags, NULL, NULL, + TRUE, dwCreationFlags, NULL, NULL, &aStartupInfo, &aProcessInformation); errno = map_errno(GetLastError()); }); Regards, Lars