From: Patrick Bennett Date: 2004-02-03T03:57:18+09:00 Subject: Questions about stdout/stderr combining (for Windows & Linux) I'm working on a build tool, and I need to execute various compilers/linkers and capture their output (both stdout and stderr) for Windows and Linux compilations (msvc & gcc). The problem is I want the output to stderr and stdout to go to the same pipe (same result as if you were running the program from the command-line). I can use a hack like: out = `cmd /c \"#{cmdLine}\" >bs.out 2>&1` on windows and then simply read bs.out (which will contain both stdout and stderr), but I'd prefer to avoid the overhead (and platform specific code) of spawning cmd.exe to run another program. I'd prefer to use something like popen, but in a way that lets me get a single pipe I can read from that the process's stdout & stderr pipes are connected to. Due to different compiler's general messages and warnings/errors being logged interchangably to stdout or stderr, it's not really feasible to have the pipes be separate. Any suggestions? -- Patrick