Matt Harrison wrote:

> I'm trying to write a script that automates some backups using dump.
> The script works well for the most part but I'm having problems
> getting the output of dump to send in the email.
> 
> I appears that dump writes all of its status output to stderr, and I
> can redirect that on the command line using "2>&1" to get it into a
> file. I'm unable however to find something similar for ruby.
> 
> I've tried backticks (``), %x{}. system() and exec() as well as
> IO.popen() but they all fail to intercept the stderr output. I've
> even tried adding "2>&1" to the command but it makes no difference.
> 
> Interestingly, other programs that output to stderr, such as usage
> messages for many programs, will let me capture the stderr output
> using the same methods.
> 
> Can anyone enlighten me as to why dump is different or another
> approach I could take to trap this output?
> 
> many thanks
> 
> Matt

C:\>ruby -e"IO.popen('verify x 2>&1'){|f| p f.read}"
"An incorrect parameter was\nentered for the command.\n"


Tested under windozeXP.

--