lib/bootstrap/bundler.rb
def capture_stdout(&block)
      old_stdout = $stdout
      $stdout = StringIO.new("", "w")
      begin
        block.call
      rescue => e
        return [$stdout.string, e]
      end

      [$stdout.string, nil]
    ensure
      $stdout = old_stdout
    end
# capture any $stdout from the passed block. also trap any exception in that block, in which case the trapped exception will be returned
# @param [Proc] the code block to execute
# @return [String, Exception] the captured $stdout string and any trapped exception or nil if none
capture any $stdout from the passed block. also trap any exception in that block, in which case the trapped exception will be returned
capture any $stdout from the passed block . also trap any exception in that block in which case the trapped exception will be returned
def capture_stdout(&block)
      old_stdout = $stdout
      $stdout = StringIO.new("", "w")
      begin
        block.call
      rescue => e
        return [$stdout.string, e]
      end
      [$stdout.string, nil]
    ensure
      $stdout = old_stdout
    end
def capture_stdout ( & block ) old_stdout = $stdout $stdout = StringIO . new ( "" , "w" ) begin block . call rescue => e return [ $stdout . string , e ] end [ $stdout . string , nil ] ensure $stdout = old_stdout end
capture any $stdout from the passed block.
capture any $stdout from the passed block .
the captured $stdout string and any trapped exception or nil if none
the captured $stdout string and any trapped exception or nil if none
String, Exception
block
the code block to execute
the code block to execute