From f870d605fac5ac2f1b68f3bfea274242cccedcea Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Sun, 1 Sep 2013 13:57:24 +0100
Subject: [PATCH] formula_installer: handle post_install exceptions.

Warn users and point them to `brew postinstall` (which can provide a
backtrace).

Closes Homebrew/homebrew#21887.
---
 Library/Homebrew/formula_installer.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 2d8d15b016..8201a1bc1c 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -118,7 +118,11 @@ class FormulaInstaller
       clean
     end
 
-    f.post_install
+    begin
+      f.post_install
+    rescue
+      opoo "#{f.name} post_install failed. Rerun with `brew postinstall #{f.name}`."
+    end
 
     opoo "Nothing was installed to #{f.prefix}" unless f.installed?
   end
-- 
GitLab