Skip to content

Commit 4b5e2da

Browse files
committed
Ensure the spring binfile from the correct gem is loaded
It turns out that Gem.bin_path won't return the bin path from the already-activated spring gem if there is a newer version on the system - in such a case it'll return the newer one, so we'll end up loading lib/spring/binstub.rb from the old version, which will then load bin/spring from the newer version. So we shouldn't rely on Gem.bin_path here, as we want to load the bin/spring from the version of the gem which has already been activated. Fixes #238.
1 parent 7a27f99 commit 4b5e2da

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/spring/binstub.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
command = File.basename($0)
1+
command = File.basename($0)
2+
bin_path = File.expand_path("../../../bin/spring", __FILE__)
23

34
if command == "spring"
4-
load Gem.bin_path("spring", "spring")
5+
load bin_path
56
else
67
disable = ENV["DISABLE_SPRING"]
78

89
if Process.respond_to?(:fork) && (disable.nil? || disable.empty? || disable == "0")
910
ARGV.unshift(command)
10-
load Gem.bin_path("spring", "spring")
11+
load bin_path
1112
end
1213
end

0 commit comments

Comments
 (0)