diff --git a/lib/capybara/webkit/connection.rb b/lib/capybara/webkit/connection.rb index 68523018..ac0bd7f7 100644 --- a/lib/capybara/webkit/connection.rb +++ b/lib/capybara/webkit/connection.rb @@ -59,9 +59,9 @@ def read(length) def start_server open_pipe + forward_output_in_background_thread discover_port discover_pid - forward_output_in_background_thread end def open_pipe diff --git a/spec/connection_spec.rb b/spec/connection_spec.rb index 445f284b..1dfad4cf 100644 --- a/spec/connection_spec.rb +++ b/spec/connection_spec.rb @@ -50,6 +50,17 @@ to raise_error(Capybara::Webkit::ConnectionError, error_string) end + it "gets stderr output if the server fails to start", skip_on_windows: true do + server_path = 'echo "A bad thing" >&2' + stub_const("Capybara::Webkit::Connection::SERVER_PATH", server_path) + + read_io, write_io = IO.pipe + expect { Capybara::Webkit::Connection.new(:stderr => write_io) }. + to raise_error(Capybara::Webkit::ConnectionError) + + expect(read_io).to include_response "A bad thing" + end + it "boots a server to talk to" do url = "http://#{@rack_server.host}:#{@rack_server.port}/" connection.puts "Visit"