Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Forward output from server pipes ASAP #739

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/capybara/webkit/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions spec/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down