1
0
Fork 0
mirror of https://github.com/teampoltergeist/poltergeist.git synced 2022-11-09 12:05:00 -05:00
teampoltergeist--poltergeist/lib/capybara/poltergeist
Dmitry Vorotilin e4c7550083 Fix #382, #404 JRuby pending test
We grab all the output from PhantomJS (like console.log) in another thread and
when PhantomJS exits first as in related test when we send
`driver.browser.command('exit')` we will try to restart it. In order to do it we
stop server and client. We see this error `IOError: Stream closed` for the
client. It happens because JRuby tries to close pipe with
https://github.com/jruby/jruby/blob/jruby-1_7/core/src/main/java/org/jruby/RubyIO.java#L2067
which raises an error here
https://github.com/jruby/jruby/blob/jruby-1_7/core/src/main/java/org/jruby/RubyIO.java#L4753
It happens not just because IO was closed but because it was blocked on `eof?`
or `readpartial` call. As you can see the error will be raised in related thread
(it's not actually main thread but the thread that listens to the output) that's
why if you put some debug code after `rescue IOError` it won't be shown and in
fact the main thread will continue working after the raise. For instance:

    def restart
      stop
      start
    end

it will invoke `start` even if we have seen `IOError` in `stop` method because
the error has been raised in another thread. In order to fix it we don't have to
give a chance to block IO. `IO.select` shows that there's something to be read
in pipe.
2013-10-27 20:16:25 +04:00
..
client Add clear_network_traffic command 2013-10-21 11:12:25 +11:00
network_traffic pass response parts as a param rather than mutating 2012-07-02 23:56:56 +01:00
browser.rb Add clear_network_traffic command 2013-10-21 11:12:25 +11:00
client.rb Fix #382, #404 JRuby pending test 2013-10-27 20:16:25 +04:00
cookie.rb Fix time zone handling for cookie expiry time 2013-01-26 21:38:19 +00:00
driver.rb Add clear_network_traffic command 2013-10-21 11:12:25 +11:00
errors.rb #395 Add better error message for wrong xpath 2013-10-03 21:02:33 +04:00
inspector.rb Remove childprocess dependency 2013-01-26 15:45:09 +00:00
json.rb Revert “Remove multi_json dependency” 2013-06-09 17:12:06 +03:00
network_traffic.rb stop using autoload 2012-07-14 17:12:45 +01:00
node.rb Using normalize_whitespace is enough 2013-09-16 11:23:00 +04:00
server.rb Fix setting of fixed port 2013-02-04 20:25:13 +00:00
utility.rb Windows support 2013-02-28 11:59:28 -06:00
version.rb Bump version 2013-09-05 19:12:41 +04:00
web_socket_server.rb Fix #382, #404 JRuby pending test 2013-10-27 20:16:25 +04:00