Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Monkey patching poltergeist for use with JRuby 1.7.11
require "capybara"
require "capybara/poltergeist"
require "capybara/poltergeist/utility"
module Capybara::Poltergeist
Client.class_eval do
def start
@pid = Process.spawn(*command.map(&:to_s), pgroup: true)
ObjectSpace.define_finalizer(self, self.class.process_killer(@pid))
end
def stop
if pid
kill_phantomjs
ObjectSpace.undefine_finalizer(self)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment