1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Keep Object#fork private

This commit is contained in:
Étienne Barrié 2019-09-30 17:01:50 -04:00
parent a273da7619
commit f223c795e8
2 changed files with 7 additions and 1 deletions

View file

@ -18,6 +18,11 @@ module ActiveSupport
end end
end end
module CoreExtPrivate
include CoreExt
private :fork
end
@pid = Process.pid @pid = Process.pid
@callbacks = [] @callbacks = []
@ -30,7 +35,7 @@ module ActiveSupport
end end
def hook! def hook!
::Object.prepend(CoreExt) ::Object.prepend(CoreExtPrivate)
::Kernel.singleton_class.prepend(CoreExt) ::Kernel.singleton_class.prepend(CoreExt)
::Process.singleton_class.prepend(CoreExt) ::Process.singleton_class.prepend(CoreExt)
end end

View file

@ -12,6 +12,7 @@ class ForkTrackerTest < ActiveSupport::TestCase
write.write "forked" write.write "forked"
end end
assert_not respond_to?(:fork)
pid = fork do pid = fork do
read.close read.close
write.close write.close