From d5085edce0b5482771c66cfe3e2c013ee3ca90f6 Mon Sep 17 00:00:00 2001
From: Xu Cheng <xu-cheng@users.noreply.github.com>
Date: Thu, 7 Apr 2016 14:57:37 +0800
Subject: [PATCH] curl: fall back to /usr/bin/curl when HOMEBREW_CURL doesn't
 exist

This can happen when `HOMEBREW_CURL` is set to brewed curl, but during

`brew resinstall curl`, brewed curl's symlink is temporary

unlinked.



So let's fallback to /usr/bin/curl in this case.
---
 Library/Homebrew/utils.rb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 4b1f6e944a..86bc270c8a 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -311,6 +311,7 @@ end
 
 def curl(*args)
   curl = Pathname.new ENV["HOMEBREW_CURL"]
+  curl = Pathname.new "/usr/bin/curl" unless curl.exist?
   raise "#{curl} is not executable" unless curl.exist? && curl.executable?
 
   flags = HOMEBREW_CURL_ARGS
-- 
GitLab