Skip to content

Commit

Permalink
Delay requiring fileutils [fix #285]
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Jan 17, 2022
1 parent bd5cff3 commit 3afe880
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/bootsnap/load_path_cache/store.rb
Expand Up @@ -3,7 +3,6 @@
require_relative("../explicit_require")

Bootsnap::ExplicitRequire.with_gems("msgpack") { require("msgpack") }
Bootsnap::ExplicitRequire.from_rubylibdir("fileutils")

module Bootsnap
module LoadPathCache
Expand Down Expand Up @@ -90,6 +89,8 @@ def load_data
end

def dump_data
require "fileutils" unless defined? FileUtils

# Change contents atomically so other processes can't get invalid
# caches if they read at an inopportune time.
tmp = "#{@store_path}.#{Process.pid}.#{(rand * 100_000).to_i}.tmp"
Expand Down

0 comments on commit 3afe880

Please sign in to comment.