Created
June 12, 2009 02:24
-
-
Save jschoolcraft/128390 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#foo.rb | |
class Foo | |
end | |
# bork.rb | |
require 'rubygems' | |
require 'active_record' | |
def bork | |
5.times do | |
start = Time.now | |
fork do | |
require 'foo.rb' | |
puts "Foo is defined in fork" if defined?(Foo) | |
if defined?(ActiveRecord::Base) | |
puts "ActiveRecord defined in fork. WIN!" | |
else | |
puts "ActiveRecord not defined in fork. FAIL!" | |
end | |
end | |
Process.wait | |
puts "took #{Time.now-start}s to rejoin parent" | |
if defined?(Foo) | |
puts "Foo is defined in parent after child exists. FAIL!" | |
else | |
puts "Foo is not defined in parent after child exists. WIN!" | |
end | |
end | |
end | |
bork |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment