From fbed65999dc8e1dd4b21a2b54a3ad3afcc5b0849 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 21 Oct 2013 04:07:21 +0000 Subject: wip for EADDRINUSE failure --- test/test_bin.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'test/test_bin.rb') diff --git a/test/test_bin.rb b/test/test_bin.rb index f6d11b2..610c99d 100644 --- a/test/test_bin.rb +++ b/test/test_bin.rb @@ -42,10 +42,13 @@ class TestBin < Testcase @cmd.concat(%W(-D -c #{cfg.path})) addr = IO.pipe pid = fork do + addr[0].close if inherit @cmd << { @srv.fileno => @srv } ENV["YAHNS_FD"] = @srv.fileno.to_s else + # we must create the socket inside the child and tell the parent + # about it to avoid sharing @srv = TCPServer.new(ENV["TEST_HOST"] || "127.0.0.1", 0) @srv.close_on_exec = true # needed for 1.9.3 end @@ -53,7 +56,6 @@ class TestBin < Testcase listen = ENV["YAHNS_TEST_LISTEN"] = "#{host}:#{port}" addr[1].write(listen) addr[1].close - addr[0].close exec(*@cmd) end addr[1].close -- cgit v1.2.3-24-ge0c7