Eval. get the console result into a variable

Did you try something simple like

caught = catch_output do
  eval 'print 1'
end
p caught

If this works (it should), then there's probably something wrong with
the string you evaluate. Does it even have output?

···

--
Posted via http://www.ruby-forum.com/.