Mark Mitchell <[EMAIL PROTECTED]> writes: > The new pex-win32.c code doesn't operate correctly when used for > MinGW-hosted tools invoked from a Cygwin window. In particular, process > creation ("gcc" invoking "as", say) results in a DOS console window > popping up. When invoked from a DOS window, things are fine. > > The reason for this problem is that the current code uses MSVCRT's spawn > to create the process, and that function doesn't provide fine enough > control. You have to use CreateProcess to make this work as desired. > When invoking CreateProcess, you must set bInheritHandle to TRUE and > pass a long a STARTUPINFO structure with dwFlags set to > STARTF_USESTDHANDLES, and the various hStd* handle fields set to the > values from the calling process. (I'm pretty sure that CodeSourcery > posted patches that did that at one point; they were in our 3.4-based > toolchains.) > > You might think that linking with -mwindows would work, and, indeed that > avoids the DOS windows popping up in Cygwin -- but they you get no > output at all under Windows. > > I guess I have two questions: (a) do you feel like fixing this, and (b) > if not, do you have any objection to using CreateProcess?
I just copied the use of spawn from the earlier pex-win32 implementation. The pex_win32_exec_child function is basically exactly the same code as before. I certainly have no objection to using CreateProcess instead. I could try a patch, but I can't test it, because I don't have a Windows system. So it might be better if somebody else tackled it. Ian