Skip to content

Commit 3339168

Browse files
committed
Silence httpc warnings
1 parent 1c3ee4e commit 3339168

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

lib/mix/lib/mix/utils.ex

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -638,17 +638,24 @@ defmodule Mix.Utils do
638638
# If a proxy environment variable was supplied add a proxy to httpc.
639639
http_options = [relaxed: true] ++ proxy_config(path)
640640

641-
case httpc_request(request, http_options) do
642-
{:error, {:failed_connect, [{:to_address, _}, {inet, _, reason}]}}
643-
when inet in [:inet, :inet6] and reason in [:ehostunreach, :enetunreach] ->
644-
:httpc.set_options([ipfamily: fallback(inet)], :mix)
645-
request |> httpc_request(http_options) |> httpc_response()
646-
647-
response ->
648-
httpc_response(response)
641+
# Silence the warning from OTP as we verify the contents
642+
level = Logger.level()
643+
Logger.configure(level: :error)
644+
645+
try do
646+
case httpc_request(request, http_options) do
647+
{:error, {:failed_connect, [{:to_address, _}, {inet, _, reason}]}}
648+
when inet in [:inet, :inet6] and reason in [:ehostunreach, :enetunreach] ->
649+
:httpc.set_options([ipfamily: fallback(inet)], :mix)
650+
request |> httpc_request(http_options) |> httpc_response()
651+
652+
response ->
653+
httpc_response(response)
654+
end
655+
after
656+
Logger.configure(level: level)
657+
:inets.stop(:httpc, :mix)
649658
end
650-
after
651-
:inets.stop(:httpc, :mix)
652659
end
653660

654661
defp fallback(:inet), do: :inet6

0 commit comments

Comments
 (0)