In Windows, I'd like to use CreatePipe and CreateProcess to launch a process, and capture the text written to stderr.
There is sample code at MSDN here: http://msdn.microsoft.com/en-us/library/windows/desktop/ms682499(v=vs.85).aspx
My problem is I want to redirect and capture STDERR, but leave STDIN and STDOUT alone. Let them still be bound to the child process's console window. (If the child process is a console process and not a window process.)
If I follow the example code, and set STARTUPINFO.hStdError to my pipe handle, and set STARTUPINFO.hStdOutput and STARTUPINFO.hStdInput to INVALID_HANDLE_VALUE, then the child process has INVALID_HANDLE_VALUE to stdin and stdout; all reads fail; all printf's go nowhere; and the console window is completely blank.
Is this even possible?