Make Connection#gets non-blocking

* JRuby Timeout::timeout blocks on IO#gets. IO.connect blocks as well
  unless running in its own thread.
This commit is contained in:
Matthew Horan 2014-07-17 09:35:45 -04:00
parent 8dbf3b8e31
commit cc6b910634
1 changed files with 7 additions and 1 deletions

View File

@ -35,7 +35,13 @@ module Capybara::Webkit
end
def gets
@socket.gets
response = ""
while !response.match(/\n/) && Thread.new { IO.select([@socket]) }.join do
response += @socket.read_nonblock(1)
end
response
end
def read(length)