From e60dc64828617a6d358687480ce4181fbb1fc12d Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Fri, 7 Aug 2015 13:56:12 +0800 Subject: only run post_install if it's defined Closes Homebrew/homebrew#42593. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/postinstall.rb | 2 +- Library/Homebrew/formula_installer.rb | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/postinstall.rb b/Library/Homebrew/cmd/postinstall.rb index 6630afba1..f20b7ad54 100644 --- a/Library/Homebrew/cmd/postinstall.rb +++ b/Library/Homebrew/cmd/postinstall.rb @@ -2,7 +2,7 @@ require "sandbox" module Homebrew def postinstall - ARGV.resolved_formulae.each { |f| run_post_install(f) } + ARGV.resolved_formulae.select(&:post_install_defined?).each { |f| run_post_install(f) } end def run_post_install(formula) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 9ea9b31ae..ba1da07bf 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -400,11 +400,13 @@ class FormulaInstaller link(keg) fix_install_names(keg) - if build_bottle? && formula.post_install_defined? - ohai "Not running post_install as we're building a bottle" - puts "You can run it manually using `brew postinstall #{formula.full_name}`" - else - post_install + if formula.post_install_defined? + if build_bottle? + ohai "Not running post_install as we're building a bottle" + puts "You can run it manually using `brew postinstall #{formula.full_name}`" + else + post_install + end end ohai "Summary" if verbose? || show_summary_heading? -- cgit v1.2.3