mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Nil error when mirror download fails
This issue causes method in a Nil object to be read when a mirror download fails. In my case, this occurs due to my office's proxy blocking certain mirrors. This patch fixes the Nil access, exposing a more helpful error message. ## Before patch ``` $ brew install maven Error: An exception occurred within a child process: NoMethodError: undefined method `unlock' for nil:NilClass ``` ## After patch ``` $ brew install maven Error: An exception occurred within a child process: DownloadError: Failed to download resource "maven" Download failed: Couldn't determine mirror, try again later. ``` ## Steps to reproduce 1. Use brew 1.8.0 2. Ensure maven is not installed: ``` brew remove maven ``` 3. Ensure the download is not cached: ``` rm "$HOME/Library/Caches/Homebrew/downloads/*--apache-maven-*-bin.tar.gz" ``` 4. Make the mirrors unreachable by pointing them at a nonfunctional proxy: ``` export http{,s}_proxy=http://localhost:8080 export no_proxy=*.github.com,*.brew.sh ``` 5. Attempt package installation ``` brew install maven ```
This commit is contained in:
parent
18bac4fa5d
commit
1f9332611f
@ -312,7 +312,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
|
|||||||
retry
|
retry
|
||||||
end
|
end
|
||||||
ensure
|
ensure
|
||||||
download_lock.unlock
|
download_lock&.unlock
|
||||||
end
|
end
|
||||||
|
|
||||||
def clear_cache
|
def clear_cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user