Matt Harrison <iwasinnamuknow / genestate.com> writes:

> 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.

open3, as others have referred you to, is most probably the Right Thing.
However, I'm puzzled why 2>&1 doesn't work for you

irb(main):004:0> %x{/sbin/dump -0 /boot}
  DUMP: Date of this level 0 dump: Sun Dec 13 22:42:35 2009
  DUMP: Dumping /dev/sdi1 (/boot) to /dev/tape
  DUMP: Cannot open /dev/sdi1
  DUMP: The ENTIRE dump is aborted.
=> ""
irb(main):005:0> %x{/sbin/dump -0 /boot 2>&1}
=> "  DUMP: Date of this level 0 dump: Sun Dec 13 22:42:42 2009\n  DUMP: Dumping /dev/sdi1 (/boot) to /dev/tape\n  DUMP: Cannot open /dev/sdi1\n  DUMP: The ENTIRE dump is aborted.\n"

Perhaps it's opening /dev/tty instead of writing to stderr, but in that
case I see nothing in the open3 docs that indicate it should fare any
better than 2>&1 does


-dan