Merge pull request #7196 from reitermarkus/curl-retry
Retry `curl` requests 3 times by default.
This commit is contained in:
		
						commit
						f357efe18d
					
				@ -168,6 +168,7 @@ Note that environment variables must have a value set to be detected. For exampl
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  * `HOMEBREW_CURL_RETRIES`:
 | 
					  * `HOMEBREW_CURL_RETRIES`:
 | 
				
			||||||
    If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).
 | 
					    If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).
 | 
				
			||||||
 | 
					    By default, `curl`(1) is invoked with `--retry 3`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  * `HOMEBREW_DEBUG`:
 | 
					  * `HOMEBREW_DEBUG`:
 | 
				
			||||||
    If set, any commands that can emit debugging information will do so.
 | 
					    If set, any commands that can emit debugging information will do so.
 | 
				
			||||||
 | 
				
			|||||||
@ -14,9 +14,13 @@ describe "curl" do
 | 
				
			|||||||
      expect(curl_args("foo").first).not_to eq("-q")
 | 
					      expect(curl_args("foo").first).not_to eq("-q")
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    it "returns --retry when HOMEBREW_CURL_RETRIES is set" do
 | 
					    it "uses `--retry 3` when HOMEBREW_CURL_RETRIES is unset" do
 | 
				
			||||||
      ENV["HOMEBREW_CURL_RETRIES"] = "3"
 | 
					 | 
				
			||||||
      expect(curl_args("foo").join(" ")).to include("--retry 3")
 | 
					      expect(curl_args("foo").join(" ")).to include("--retry 3")
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    it "uses the given value for `--retry` when HOMEBREW_CURL_RETRIES is set" do
 | 
				
			||||||
 | 
					      ENV["HOMEBREW_CURL_RETRIES"] = "10"
 | 
				
			||||||
 | 
					      expect(curl_args("foo").join(" ")).to include("--retry 10")
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
@ -39,7 +39,8 @@ def curl_args(*extra_args, show_output: false, user_agent: :default)
 | 
				
			|||||||
    args << "--silent" unless $stdout.tty?
 | 
					    args << "--silent" unless $stdout.tty?
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  args << "--retry" << ENV["HOMEBREW_CURL_RETRIES"] if ENV["HOMEBREW_CURL_RETRIES"]
 | 
					  # When changing the default value, the manpage has to be updated.
 | 
				
			||||||
 | 
					  args << "--retry" << (ENV["HOMEBREW_CURL_RETRIES"] || "3")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  args + extra_args
 | 
					  args + extra_args
 | 
				
			||||||
end
 | 
					end
 | 
				
			||||||
 | 
				
			|||||||
@ -1200,6 +1200,7 @@ Note that environment variables must have a value set to be detected. For exampl
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  * `HOMEBREW_CURL_RETRIES`:
 | 
					  * `HOMEBREW_CURL_RETRIES`:
 | 
				
			||||||
    If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).
 | 
					    If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).
 | 
				
			||||||
 | 
					    By default, `curl`(1) is invoked with `--retry 3`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  * `HOMEBREW_DEBUG`:
 | 
					  * `HOMEBREW_DEBUG`:
 | 
				
			||||||
    If set, any commands that can emit debugging information will do so.
 | 
					    If set, any commands that can emit debugging information will do so.
 | 
				
			||||||
 | 
				
			|||||||
@ -1496,7 +1496,7 @@ If set, Homebrew will pass \fB\-\-verbose\fR when invoking \fBcurl\fR(1)\.
 | 
				
			|||||||
.
 | 
					.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
\fBHOMEBREW_CURL_RETRIES\fR
 | 
					\fBHOMEBREW_CURL_RETRIES\fR
 | 
				
			||||||
If set, Homebrew will pass the given retry count to \fB\-\-retry\fR when invoking \fBcurl\fR(1)\.
 | 
					If set, Homebrew will pass the given retry count to \fB\-\-retry\fR when invoking \fBcurl\fR(1)\. By default, \fBcurl\fR(1) is invoked with \fB\-\-retry 3\fR\.
 | 
				
			||||||
.
 | 
					.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
\fBHOMEBREW_DEBUG\fR
 | 
					\fBHOMEBREW_DEBUG\fR
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user