Sha256: 36593904df2bb66cf48e13a04f2a52424d276c09b9757d3d0e2d162dea530f83

Contents?: true

Size: 481 Bytes

Versions: 123

Compression:

Stored size: 481 Bytes

Contents

class IO
  def read_available_bytes(chunk_size = 16384, select_timeout = 0.02)
    buffer = []

    return "" if closed? || eof?
    # IO.select cannot be used here due to the fact that it
    # just does not work on windows
    while true
      begin
        IO.select([self], nil, nil, select_timeout)
        break if eof? # stop raising :-(
        buffer << self.readpartial(chunk_size)
      rescue(EOFError)
        break
      end
    end

    return buffer.join
  end
end

Version data entries

123 entries across 123 versions & 9 rubygems

Version Path
bundler-1.7.15 spec/support/ruby_ext.rb
bundler-1.7.14 spec/support/ruby_ext.rb
bundler-1.7.13 spec/support/ruby_ext.rb
bundler-1.7.12 spec/support/ruby_ext.rb
bundler-1.7.11 spec/support/ruby_ext.rb
bundler-1.7.10 spec/support/ruby_ext.rb
bundler-1.7.9 spec/support/ruby_ext.rb
bundler-1.7.8 spec/support/ruby_ext.rb
bundler-1.7.7 spec/support/ruby_ext.rb
bundler-1.7.6 spec/support/ruby_ext.rb
bundler-1.6.9 spec/support/ruby_ext.rb
bundler-1.7.5 spec/support/ruby_ext.rb
bundler-1.6.8 spec/support/ruby_ext.rb
bundler-1.7.4 spec/support/ruby_ext.rb
bundler-1.6.7 spec/support/ruby_ext.rb
bundler-1.7.3 spec/support/ruby_ext.rb
bundler-1.6.6 spec/support/ruby_ext.rb
bundler-1.7.2 spec/support/ruby_ext.rb
bundler-1.7.1 spec/support/ruby_ext.rb
bundler-1.7.1.pre.3 spec/support/ruby_ext.rb