class RSpec::Cli::IODecorator
Public Instance Methods
has_data?(timeout = 0)
click to toggle source
# File lib/rspec/cli/i_o_decorator.rb, line 11 def has_data?(timeout = 0) IO.select([self], nil, nil, timeout) ? true : false end
read_all(nonblocking = false)
click to toggle source
This fails on huge data blocks. the has_data? thing migth be returning false when the system is about to refill the stream with more data. Essentially a race condition
# File lib/rspec/cli/i_o_decorator.rb, line 18 def read_all nonblocking = false if nonblocking && !has_data? return nil end # Block until data has arrived. data = readpartial 0xFFFF # If there is more data in the buffer, retrieve it nonblocking. while has_data? data << readpartial(0xFFFF) end data end