From: Matt Harrison Date: 2009-12-14T04:56:31+09:00 Subject: Re: getting shell output On Mon, Dec 14, 2009 at 04:34:20AM +0900, Marvin G??lker wrote: > Matt Harrison wrote: > > 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. > > Try open3 from the stdlib: > -------------------------- > require "open3" > Open3.popen3("command") do |stdin, stdout, stderr| > #Your code... > end > --------------------------- Thanks Marvin, that works perfectly. God knows why stderr wasn't getting intercepted with the others, but with open3 it works beautifully. Thanks again Matt