In my gem rails-web-console, I want to redirect all output from the 
code sent by the web to some var to send back to the browser:

https://github.com/rosenfeld/rails-web-console

All other gems that do something similar, use an approach similar to 
(trust me, real small code):

https://github.com/rosenfeld/rails-web-console/blob/master/app/controllers/console_controller.rb

That means that every output generated from different threads will be 
captured, which is not what I wanted.

I would like to suggest Ruby to implement some way for capturing stdout 
only inside a specific lambda, like:

Thread.start { (puts 'not captured output'; sleep 1) while true}

output = capture_stdout do
     puts 'abc' # go to stdout
     Thread.start {
         puts 'def' # not sure if it is possible to store output inside 
threads started from this block too
         # but for my specific case, it wouldn't be very useful either, 
since I'll send the output to the browser before I get the output from 
this thread (unless I'm using something like websockets or cometd)
     }
end

Is this feature request reasonable? Is it already currently possible to 
do that somehow?

Thanks in advance,

Rodrigo