Skip to content

Instantly share code, notes, and snippets.

@jonstokes
Created July 13, 2014 23:33
Show Gist options
  • Save jonstokes/04b10617a497ec2cc8a8 to your computer and use it in GitHub Desktop.
Save jonstokes/04b10617a497ec2cc8a8 to your computer and use it in GitHub Desktop.
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