From 19ccb572cddf8028b9aceb349bd1e39a3131b2c5 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 8 Dec 2021 11:26:12 +0800 Subject: [PATCH 1/2] goproxy: avoid subshells This seems to make the test hang indefinitely (e.g. #90350). Let's also sleep for longer since short `sleep`s tend to cause trouble in CI. --- Formula/goproxy.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Formula/goproxy.rb b/Formula/goproxy.rb index c6317e2886705..6b6775b299848 100644 --- a/Formula/goproxy.rb +++ b/Formula/goproxy.rb @@ -25,8 +25,11 @@ def install test do bind_address = "127.0.0.1:#{free_port}" begin - server = IO.popen("#{bin}/goproxy -proxy=https://goproxy.io -listen=#{bind_address}", err: [:child, :out]) - sleep 1 + server = IO.popen( + ["#{bin}/goproxy", "-proxy=https://goproxy.io", "-listen=#{bind_address}"], + err: [:child, :out], + ) + sleep 10 ENV["GOPROXY"] = "http://#{bind_address}" test_module = "github.com/spf13/cobra" system "go", "get", test_module From 8713909608da9e2e4d76092ce555932f8c95d40b Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Wed, 8 Dec 2021 12:18:03 +0800 Subject: [PATCH 2/2] Revert "goproxy: avoid subshells" Also get rid of the `ensure` block to see if we can get this to start timing out. This reverts commit 19ccb572cddf8028b9aceb349bd1e39a3131b2c5. --- Formula/goproxy.rb | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Formula/goproxy.rb b/Formula/goproxy.rb index 6b6775b299848..439a7cb28a9e0 100644 --- a/Formula/goproxy.rb +++ b/Formula/goproxy.rb @@ -25,17 +25,15 @@ def install test do bind_address = "127.0.0.1:#{free_port}" begin - server = IO.popen( - ["#{bin}/goproxy", "-proxy=https://goproxy.io", "-listen=#{bind_address}"], - err: [:child, :out], - ) - sleep 10 + server = IO.popen("#{bin}/goproxy -proxy=https://goproxy.io -listen=#{bind_address}", err: [:child, :out]) + sleep 1 ENV["GOPROXY"] = "http://#{bind_address}" test_module = "github.com/spf13/cobra" system "go", "get", test_module ensure - Process.kill("SIGINT", server.pid) - Process.wait(server.pid) + nil + # Process.kill("SIGINT", server.pid) + # Process.wait(server.pid) end assert_match test_module, server.read end