File tree Expand file tree Collapse file tree 2 files changed +13
-11
lines changed
src/main/ruby/truffleruby Expand file tree Collapse file tree 2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -105,16 +105,18 @@ def p(*a)
105
105
ARGV . concat ( Truffle ::Boot . original_argv )
106
106
end
107
107
108
- ruby_home = Truffle ::Boot . ruby_home
109
- if ruby_home
110
- # Does not exist but it's used by rubygems to determine index where to insert gem lib directories, as a result
111
- # paths supplied by -I will stay before gem lib directories. See Gem.load_path_insert_index in rubygems.rb.
112
- # Must be kept in sync with the value of RbConfig::CONFIG['sitelibdir'].
113
- $LOAD_PATH. push "#{ ruby_home } /lib/ruby/site_ruby/#{ RUBY_ENGINE_VERSION } "
114
-
115
- $LOAD_PATH. push "#{ ruby_home } /lib/truffle"
116
- $LOAD_PATH. push "#{ ruby_home } /lib/mri"
117
- $LOAD_PATH. push "#{ ruby_home } /lib/json/lib"
108
+ yield_self do # Avoid capturing ruby_home in the at_exit and delay blocks
109
+ ruby_home = Truffle ::Boot . ruby_home
110
+ if ruby_home
111
+ # Does not exist but it's used by rubygems to determine index where to insert gem lib directories, as a result
112
+ # paths supplied by -I will stay before gem lib directories. See Gem.load_path_insert_index in rubygems.rb.
113
+ # Must be kept in sync with the value of RbConfig::CONFIG['sitelibdir'].
114
+ $LOAD_PATH. push "#{ ruby_home } /lib/ruby/site_ruby/#{ RUBY_ENGINE_VERSION } "
115
+
116
+ $LOAD_PATH. push "#{ ruby_home } /lib/truffle"
117
+ $LOAD_PATH. push "#{ ruby_home } /lib/mri"
118
+ $LOAD_PATH. push "#{ ruby_home } /lib/json/lib"
119
+ end
118
120
end
119
121
120
122
Truffle ::Boot . delay do
Original file line number Diff line number Diff line change 83
83
end
84
84
end
85
85
end
86
- old_home = nil
86
+ old_home = nil # Avoid capturing the old home in the blocks below
87
87
88
88
Truffle ::Boot . delay do
89
89
new_home = Truffle ::Boot . ruby_home
You can’t perform that action at this time.
0 commit comments