From: Brian Candler Date: 2003-05-07T19:12:16+09:00 Subject: Re: capture output On Wed, May 07, 2003 at 05:14:57PM +0900, Simon Strandgaard wrote: > I want to capture all output from ruby, so that > ruby cannot interfere with that application that > im embedding ruby into. Silencing ruby 100%! $defout = $stdout = $stderr = File.open("/dev/null","w") I don't see the point though. If Ruby needs to report something on stderr, then it's probably worth seeing - just the same as if your C application decided to print something on stderr. Now, if you want to prevent the C app from outputing to stderr, then you'd perhaps write something like close(2); /* close(stderr_fileno) is better */ or use dup2 to associate stderr with /dev/null, which should also do the trick, since your embedded Ruby interpreter will share stderr with it. This seems unrelated to capturing the output of child processes though; that's a different question, and is exactly the same as if you were spawning a child process from C (using 'system()' for example). In other words, I think it's orthogonal to any Ruby issue. Brian.