Patrick Bennett wrote: > 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). > (...) > 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. This works for me on Windows 2000, Ruby 1.8.0: D:\Temp>type r.rb def parent IO.popen "ruby #{__FILE__} child 2>&1" do |io| while line = io.gets puts "got #{line}" end end end def child $stdout.puts "child 1 out"; $stdout.flush $stderr.puts "child 2 err"; $stderr.flush $stderr.puts "child 3 err"; $stderr.flush $stdout.puts "child 4 out"; $stdout.flush end ARGV.empty? ? parent : child D:\Temp>r got child 1 out got child 2 err got child 3 err got child 4 out D:\Temp> HTH Regards, Pit