Skip to content

Commit 0bd2158

Browse files
committed
Fix issues with require "bundler/setup"
If your ruby's bundler is different from the saved result in `Gemfile.lock`, bundler autoswitches by starting a new process. When it does this it sometimes doesn't pick up the old LOAD_PATH and results in a LoadError. Switch to use `Bundler.setup`, which is a simpler process and uses the current bundler.
1 parent 9e30bb6 commit 0bd2158

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

harness/harness-common.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ def use_gemfile(extra_setup_cmd: nil)
4444
setup_cmds(["bundle check 2> /dev/null || bundle install", extra_setup_cmd].compact)
4545

4646
# Need to be in the appropriate directory for this...
47-
require "bundler/setup"
47+
require "bundler"
48+
# Use Bundler.setup instead of require 'bundler/setup' to avoid bundler's autoswitch restarting the
49+
# process and messing with LOAD_PATH.
50+
Bundler.setup
4851
end
4952

5053
# This returns its best estimate of the Resident Set Size in bytes.

0 commit comments

Comments
 (0)