mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
fix(fork-tracker): Only patch fork if it's supported
Some tests are currently wrapped with `if Process.respond_to?(:fork)` but they're still executed on JRuby. The problem is that ForkTracker unconditionally patches `#fork` so `Process` does indeed `respond_to? :fork`. Fix it by installing the patch conditionally with the same check.
This commit is contained in:
parent
a4ea17f6b6
commit
f3260272f2
2 changed files with 7 additions and 5 deletions
|
@ -35,10 +35,12 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def hook!
|
||||
::Object.prepend(CoreExtPrivate)
|
||||
::Kernel.prepend(CoreExtPrivate)
|
||||
::Kernel.singleton_class.prepend(CoreExt)
|
||||
::Process.singleton_class.prepend(CoreExt)
|
||||
if Process.respond_to?(:fork)
|
||||
::Object.prepend(CoreExtPrivate)
|
||||
::Kernel.prepend(CoreExtPrivate)
|
||||
::Kernel.singleton_class.prepend(CoreExt)
|
||||
::Process.singleton_class.prepend(CoreExt)
|
||||
end
|
||||
end
|
||||
|
||||
def after_fork(&block)
|
||||
|
|
|
@ -207,4 +207,4 @@ class ForkTrackerTest < ActiveSupport::TestCase
|
|||
ensure
|
||||
ActiveSupport::ForkTracker.unregister(handler)
|
||||
end
|
||||
end
|
||||
end if Process.respond_to?(:fork)
|
||||
|
|
Loading…
Reference in a new issue