Skip to content

Instantly share code, notes, and snippets.

@jschoolcraft
Created June 12, 2009 02:24
Show Gist options
  • Save jschoolcraft/128390 to your computer and use it in GitHub Desktop.
Save jschoolcraft/128390 to your computer and use it in GitHub Desktop.
#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