Created
July 13, 2014 23:33
-
-
Save jonstokes/04b10617a497ec2cc8a8 to your computer and use it in GitHub Desktop.
Monkey patching poltergeist for use with JRuby 1.7.11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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