1
0
Fork 0
mirror of https://github.com/teampoltergeist/poltergeist.git synced 2022-11-09 12:05:00 -05:00

Use posix-spawn gem rather than sfl, as sfl requires fork, which can't work on JRuby.

This commit is contained in:
Jon Leighton 2012-02-29 22:45:14 +00:00
parent 0b9d286e3f
commit f61ca77cd4
4 changed files with 7 additions and 5 deletions

View file

@ -1,4 +1,4 @@
require 'sfl'
require 'posix/spawn'
module Capybara::Poltergeist
class Client
@ -22,7 +22,7 @@ module Capybara::Poltergeist
def start
check_phantomjs_version
@pid = Kernel.spawn(command)
@pid = POSIX::Spawn.spawn(command)
end
def stop

View file

@ -1,3 +1,5 @@
require 'posix/spawn'
module Capybara::Poltergeist
class Inspector
BROWSERS = %w(chromium chromium-browser google-chrome safari)
@ -24,7 +26,7 @@ module Capybara::Poltergeist
def open
if browser
Kernel.spawn("#{browser} #{url}")
POSIX::Spawn.spawn("#{browser} #{url}")
else
raise Error, "Could not find a browser executable to open #{url}. " \
"You can specify one manually using e.g. `:inspector => 'chromium'` " \

View file

@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.add_dependency "capybara", "~> 1.0"
s.add_dependency "json", "~> 1.6"
s.add_dependency "sfl", "~> 2.0"
s.add_dependency "posix-spawn", "~> 0.3"
s.add_dependency "http_parser.rb", "~> 0.5.3"
s.add_dependency "faye-websocket", "~> 0.2"

View file

@ -27,7 +27,7 @@ module Capybara::Poltergeist
it 'can be opened' do
subject.stub(:port => 1234, :browser => 'chromium')
Kernel.should_receive(:spawn).with("chromium http://localhost:1234/")
POSIX::Spawn.should_receive(:spawn).with("chromium http://localhost:1234/")
subject.open
end