New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Requiring fileutils
directly from the ruby lib dir can cause already initialized constant
warnings
#285
Comments
Can you provide an example application that reproduce the issue? |
@rafaelfranca Sure, here is an example: https://github.com/aar0nr/bootsnap-issue-285 Just run,
TLDR: If any code executed before bootsnap uses the |
Bootsnap must be setup before any other file is required. As explained in the README: https://github.com/Shopify/bootsnap#usage.
|
Yes, but Spring requires |
If you're using Spring with Bootsnap, Spring requires
fileutils
via gem name (i.e.require 'fileutils'
, which in turn, always loads the latest version installed. Bootsnap requiresfileutils
directly from the ruby lib dir, which can causealready initialized constant FileUtils::
if you have multiple versions installed.For example, on my system I have the following versions installed:
fileutils (1.4.1, default: 1.1.0)
Spring will load
v1.4.1
, and Bootsnap will loadv1.1.0
.Any suggestions? Or maybe Bootsnap should check if the
FileUtils
constant is already loaded before trying to require it? Thanks for your time.Update 1
This really has nothing to do with Spring, it just so happens it uses
fileutils
and it's run before Bootsnap.The text was updated successfully, but these errors were encountered: