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/spawn.rb
Jon Leighton 98c3bb564f Remove posix-spawn dependency.
posix-spawn relies on a C extension. This does work under JRuby, but it
won't work on Travis CI as they disallow JRuby C extensions, as they are
considered to not be a good practice.

Instead we are using either Process.spawn on Ruby 1.9, or the
childprocess gem on Ruby 1.8. childprocess uses native JVM APIs on
JRuby, and fork+exec on others.
2012-03-11 10:35:02 +00:00

17 lines
310 B
Ruby

require 'childprocess'
module Capybara::Poltergeist
module Spawn
def self.spawn(*args)
args = args.map(&:to_s)
if RUBY_VERSION >= "1.9"
Process.spawn(*args)
else
process = ChildProcess.build(*args)
process.start
process.pid
end
end
end
end