Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
Clean RUBYLIB as well in with_clean_env
Browse files Browse the repository at this point in the history
This still needs tests to ensure that `with_clean_env` does the right
thing.

refs #3982
  • Loading branch information
indirect committed Sep 8, 2015
1 parent 1131091 commit 3ae70bb
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions lib/bundler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,19 @@ def with_original_env

def with_clean_env
with_original_env do
ENV['MANPATH'] = ENV['BUNDLE_ORIG_MANPATH']
ENV.delete_if { |k,_| k[0,7] == 'BUNDLE_' }
if ENV.has_key? 'RUBYOPT'
ENV['RUBYOPT'] = ENV['RUBYOPT'].sub '-rbundler/setup', ''
ENV['RUBYOPT'] = ENV['RUBYOPT'].sub "-I#{File.expand_path('..', __FILE__)}", ''
ENV["MANPATH"] = ENV["BUNDLE_ORIG_MANPATH"]
ENV.delete_if { |k,_| k[0,7] == "BUNDLE_" }

if ENV.has_key?("RUBYOPT")
ENV["RUBYOPT"] = ENV["RUBYOPT"].sub "-rbundler/setup", ""
end

if ENV.has_key?("RUBYLIB")
rubylib = ENV["RUBYLIB"].split(File::PATH_SEPARATOR)
rubylib.delete(File.expand_path("..", __FILE__))
ENV["RUBYLIB"] = rubylib.join(File::PATH_SEPARATOR)
end

yield
end
end
Expand Down

0 comments on commit 3ae70bb

Please sign in to comment.