# File lib/drydock.rb, line 804
804:   def capture_io(stream, &block)
805:     raise "We can only capture STDOUT or STDERR" unless stream == :stdout || stream == :stderr
806:     begin
807:       eval "$#{stream} = StringIO.new"
808:       block.call
809:       eval("$#{stream}").rewind                  # Otherwise we'll get nil 
810:       result = eval("$#{stream}").read
811:     ensure
812:       eval "$#{stream} = #{stream.to_s.upcase}"  # Put it back!
813:     end
814:   end