From 79295ecaf83fc390cbe45f029f8a8a35511dddf2 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 9 Jan 2013 19:25:02 -0600 Subject: [PATCH] More robust way to avoid attempting to marshal Procs --- Library/Homebrew/formula.rb | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index f8a21ab364..59c1d104a0 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -26,7 +26,6 @@ class Formula set_instance_variable :bottle set_instance_variable :devel set_instance_variable :head - set_instance_variable :test @name = name validate_variable :name @@ -591,14 +590,14 @@ public ret = nil mktemp do @testpath = Pathname.pwd - ret = instance_eval(&@test) + ret = instance_eval(&self.class.test) @testpath = nil end ret end def test_defined? - not @test.nil? + not self.class.instance_variable_get(:@test_defined).nil? end private @@ -651,7 +650,7 @@ private when :brew raise "You cannot override Formula#brew" when :test - @test = method + @test_defined = true end end @@ -800,11 +799,8 @@ private def test &block return @test unless block_given? - # If this formula is the executing script, we are performing an - # install. Since it may be marshalled back to the main process as - # part of an exception, don't store this Proc because Procs can't - # be marshalled. - @test = block unless $0 != HOMEBREW_BREW_FILE.to_s + @test_defined = true + @test = block end end end