From e113fd70be1fb12b1b40cf6d6bfb26781f83fa0f Mon Sep 17 00:00:00 2001 From: Maik Riechert Date: Fri, 17 May 2019 10:14:54 +0100 Subject: [PATCH] add HOMEBREW_CURL_RETRIES --- Library/Homebrew/manpages/brew.1.md.erb | 3 +++ Library/Homebrew/test/utils/curl_spec.rb | 5 +++++ Library/Homebrew/utils/curl.rb | 2 ++ docs/Manpage.md | 3 +++ manpages/brew.1 | 4 ++++ 5 files changed, 17 insertions(+) diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index a2d916ee74..87897ca4e6 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -158,6 +158,9 @@ Note that environment variables must have a value set to be detected. For exampl * `HOMEBREW_CURL_VERBOSE`: If set, Homebrew will pass `--verbose` when invoking `curl`(1). + * `HOMEBREW_CURL_RETRIES`: + If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1). + * `HOMEBREW_DEBUG`: If set, any commands that can emit debugging information will do so. diff --git a/Library/Homebrew/test/utils/curl_spec.rb b/Library/Homebrew/test/utils/curl_spec.rb index a6973aa192..baab4d4bdc 100644 --- a/Library/Homebrew/test/utils/curl_spec.rb +++ b/Library/Homebrew/test/utils/curl_spec.rb @@ -13,5 +13,10 @@ describe "curl" do ENV["HOMEBREW_CURLRC"] = "1" expect(curl_args("foo").first).not_to eq("-q") end + + it "returns --retry when HOMEBREW_CURL_RETRIES is set" do + ENV["HOMEBREW_CURL_RETRIES"] = "3" + expect(curl_args("foo").join(" ")).to include("--retry 3") + end end end diff --git a/Library/Homebrew/utils/curl.rb b/Library/Homebrew/utils/curl.rb index d801dce907..6bd2333bd3 100644 --- a/Library/Homebrew/utils/curl.rb +++ b/Library/Homebrew/utils/curl.rb @@ -37,6 +37,8 @@ def curl_args(*extra_args, show_output: false, user_agent: :default) args << "--silent" unless $stdout.tty? end + args << "--retry" << ENV["HOMEBREW_CURL_RETRIES"] if ENV["HOMEBREW_CURL_RETRIES"] + args + extra_args end diff --git a/docs/Manpage.md b/docs/Manpage.md index 149d8743a0..ec53fb1924 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1045,6 +1045,9 @@ Note that environment variables must have a value set to be detected. For exampl * `HOMEBREW_CURL_VERBOSE`: If set, Homebrew will pass `--verbose` when invoking `curl`(1). + * `HOMEBREW_CURL_RETRIES`: + If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1). + * `HOMEBREW_DEBUG`: If set, any commands that can emit debugging information will do so. diff --git a/manpages/brew.1 b/manpages/brew.1 index fc624acea7..5124ebc663 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1278,6 +1278,10 @@ If set, Homebrew will not pass \fB\-q\fR when invoking \fBcurl\fR(1) (which disa If set, Homebrew will pass \fB\-\-verbose\fR when invoking \fBcurl\fR(1)\. . .TP +\fBHOMEBREW_CURL_RETRIES\fR +If set, Homebrew will pass the given retry count to \fB\-\-retry\fR when invoking \fBcurl\fR(1)\. +. +.TP \fBHOMEBREW_DEBUG\fR If set, any commands that can emit debugging information will do so\. .