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

Fix ForkTracker on ruby <= 2.5.3

Making the fork method private by calling `private :fork` raises a
"no superclass method `fork'" error when calling super in a subclass on
ruby <= 2.5.3. The error doesn't occur on ruby 2.5.4 and higher.
Making the method private by redefining doesn't raise the error.

The possible fix on 2.5.4 is 75aba10d7a

The error can be reproduced with the following script on ruby 2.5.3:
```
class Cluster
  def start
    fork { puts "forked!" }
  end
end

module CoreExt
  def fork(*)
    super
  end
end

module CoreExtPrivate
  include CoreExt
  private :fork
end

::Object.prepend(CoreExtPrivate)
Cluster.new.start
```

Fixes #40603
This commit is contained in:
Petrik 2020-11-17 21:02:06 +01:00
parent 000e2853fa
commit 332a2909d4

View file

@ -20,7 +20,11 @@ module ActiveSupport
module CoreExtPrivate
include CoreExt
private :fork
private
def fork(*)
super
end
end
@pid = Process.pid