More robust way to avoid attempting to marshal Procs
This commit is contained in:
parent
003a9e7fd7
commit
79295ecaf8
@ -26,7 +26,6 @@ class Formula
|
|||||||
set_instance_variable :bottle
|
set_instance_variable :bottle
|
||||||
set_instance_variable :devel
|
set_instance_variable :devel
|
||||||
set_instance_variable :head
|
set_instance_variable :head
|
||||||
set_instance_variable :test
|
|
||||||
|
|
||||||
@name = name
|
@name = name
|
||||||
validate_variable :name
|
validate_variable :name
|
||||||
@ -591,14 +590,14 @@ public
|
|||||||
ret = nil
|
ret = nil
|
||||||
mktemp do
|
mktemp do
|
||||||
@testpath = Pathname.pwd
|
@testpath = Pathname.pwd
|
||||||
ret = instance_eval(&@test)
|
ret = instance_eval(&self.class.test)
|
||||||
@testpath = nil
|
@testpath = nil
|
||||||
end
|
end
|
||||||
ret
|
ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_defined?
|
def test_defined?
|
||||||
not @test.nil?
|
not self.class.instance_variable_get(:@test_defined).nil?
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@ -651,7 +650,7 @@ private
|
|||||||
when :brew
|
when :brew
|
||||||
raise "You cannot override Formula#brew"
|
raise "You cannot override Formula#brew"
|
||||||
when :test
|
when :test
|
||||||
@test = method
|
@test_defined = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -800,11 +799,8 @@ private
|
|||||||
|
|
||||||
def test &block
|
def test &block
|
||||||
return @test unless block_given?
|
return @test unless block_given?
|
||||||
# If this formula is the executing script, we are performing an
|
@test_defined = true
|
||||||
# install. Since it may be marshalled back to the main process as
|
@test = block
|
||||||
# part of an exception, don't store this Proc because Procs can't
|
|
||||||
# be marshalled.
|
|
||||||
@test = block unless $0 != HOMEBREW_BREW_FILE.to_s
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user