From: MikkelFJ Date: 2001-12-20T00:18:51+09:00 Subject: [ruby-talk:28944] Re: stderr from external process? Now I have got something working in Ruby (partially) I'd not call it elegant but... I don't know how the following would work in non-cygwin. With cygwin, you can't specify things like "date", "ls" or "dir" as a process. But at least you get the process error message out on the stderr pipe. Which is a good sign. However, "cmd" works - see below. ("cmd" is the WinNT equivalent to "command" in dos and "sh" on unix). (On one of my Win2K machines, cygwin is seriously messed up, but it works on the other machine). Instead of starting a new command line processor each time I need to execute a command a command, I just feed it like a normal user would. The output is read in a separate process. Since fork propably doesn't work in Win32, both open3.rb and the source below would probably have to use some Ruby threads if that can be made to work. I still have one issue though: The program doesn't terminate. Admittely I don't know much about these process issues, but I would expect the write processes to terminate when the main program closes the pipes. Any suggestions? require 'open3' sin, sout, serr = Open3.popen3("cmd", "w+") fork do sout.each_line {|line| puts line } end fork do serr.each_line {|line| puts line } end sin.puts "dir" sin.puts "dir" sin.close_write sout.close serr.close (Boost.Build does not seem to be mature for NT yet... can't get it working )