Skip to content

Commit

Permalink
Merge pull request #616 from deivid-rodriguez/lazily_load_tmpdir_and_…
Browse files Browse the repository at this point in the history
…fileutils

Lazily load fileutils and tmpdir
  • Loading branch information
rafaelfranca authored Feb 18, 2021
2 parents 24d9e93 + daa5096 commit 577cf01
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/spring/env.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require "pathname"
require "fileutils"
require "digest/md5"
require "tmpdir"

require "spring/version"
require "spring/sid"
Expand Down Expand Up @@ -33,10 +31,12 @@ def version
end

def tmp_path
require "tmpdir"
path = Pathname.new(
ENV["SPRING_TMP_PATH"] ||
File.join(ENV['XDG_RUNTIME_DIR'] || Dir.tmpdir, "spring-#{Process.uid}")
)
require "fileutils"
FileUtils.mkdir_p(path) unless path.exist?
path
end
Expand Down

0 comments on commit 577cf01

Please sign in to comment.