1
0
Fork 0
mirror of https://github.com/thoughtbot/capybara-webkit synced 2023-03-27 23:22:28 -04:00

Use Process.spawn to spawn webkit_server whenever possible.

This allows one to close all unnecessary file descriptors in the child
process so they don't conflict with whatever the app is expecting.
It solves some problems with DRb.
This commit is contained in:
Hongli Lai (Phusion) 2011-08-17 17:41:36 +02:00
parent dc49e5f875
commit 922d197adf

View file

@ -93,10 +93,18 @@ class Capybara::Driver::Webkit
server_path = File.expand_path("../../../../../bin/webkit_server", __FILE__)
read_pipe, write_pipe = IO.pipe
@pid = fork do
$stdout.reopen write_pipe
read_pipe.close
exec(server_path)
if Process.respond_to?(:spawn)
@pid = Process.spawn(server_path,
:in => :in,
:out => write_pipe,
:err => :err,
:close_others => true)
else
@pid = fork do
$stdout.reopen write_pipe
read_pipe.close
exec(server_path)
end
end
at_exit { Process.kill("INT", @pid) }