Closed marvinthepa closed 3 years ago
When running it via spring-watcher-listen, I get a lot of these warnings:
vendor/bundle/ruby/3.0/gems/rb-kqueue-0.2.6/lib/rb-kqueue/watcher/file.rb:40: warning: finalizer references object to be finalized
It seems to me that this PR: https://github.com/ruby/ruby/pull/3444 created this warning. Following the links, it seems that this https://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/ describes the fix: use a class method that creates the lambda:
- ObjectSpace.define_finalizer(self, lambda do + ObjectSpace.define_finalizer(self, self.class.finalize(@fd, path)) ... + def self.finalize(fd, path) + lambda do + next unless Native.close(fd) < 0 + ...
Please note that I have not tested this.
Do you want a pull request?
When running it via spring-watcher-listen, I get a lot of these warnings:
vendor/bundle/ruby/3.0/gems/rb-kqueue-0.2.6/lib/rb-kqueue/watcher/file.rb:40: warning: finalizer references object to be finalized
It seems to me that this PR: https://github.com/ruby/ruby/pull/3444 created this warning. Following the links, it seems that this https://www.mikeperham.com/2010/02/24/the-trouble-with-ruby-finalizers/ describes the fix: use a class method that creates the lambda:
Please note that I have not tested this.
Do you want a pull request?