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:
parent
dc49e5f875
commit
922d197adf
1 changed files with 12 additions and 4 deletions
|
@ -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) }
|
||||
|
||||
|
|
Loading…
Reference in a new issue