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:
parent
000e2853fa
commit
332a2909d4
1 changed files with 5 additions and 1 deletions
|
@ -20,7 +20,11 @@ module ActiveSupport
|
|||
|
||||
module CoreExtPrivate
|
||||
include CoreExt
|
||||
private :fork
|
||||
|
||||
private
|
||||
def fork(*)
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
@pid = Process.pid
|
||||
|
|
Loading…
Reference in a new issue