summaryrefslogtreecommitdiff
path: root/lib/bundler
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-08 13:41:03 +0200
committerDavid Rodríguez <deivid.rodriguez@riseup.net>2019-05-12 09:25:06 -0400
commita5da088a6d8aa2bb14d5007dc7f70b25a50d79d7 (patch)
treef06982e7259c91ca4205ef8407068a93bad2e393 /lib/bundler
parentb874d63cd3cfdd2d52a5e6fa849c8b7a3f116d1b (diff)
downloadbundler-a5da088a6d8aa2bb14d5007dc7f70b25a50d79d7.tar.gz
Setup rubyopt to require bundler absolutely
This way, we will never leak to a different bundler copy.
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/shared_helpers.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb
index e56a44a559..da2a384d29 100644
--- a/lib/bundler/shared_helpers.rb
+++ b/lib/bundler/shared_helpers.rb
@@ -291,8 +291,9 @@ module Bundler
def set_rubyopt
rubyopt = [ENV["RUBYOPT"]].compact
- return if !rubyopt.empty? && rubyopt.first =~ %r{-rbundler/setup}
- rubyopt.unshift %(-rbundler/setup)
+ setup_require = "-r#{File.expand_path("setup", __dir__)}"
+ return if !rubyopt.empty? && rubyopt.first =~ /#{setup_require}/
+ rubyopt.unshift %(#{setup_require})
Bundler::SharedHelpers.set_env "RUBYOPT", rubyopt.join(" ")
end