Skip to content

Commit 9a83da1

Browse files
committed
Include "ruby2_keywords.rb" in $LOADED_FEATURES like MRI
* Hardcoded instead of a real file to pass this test: https://github.com/ruby/ruby2_keywords/blob/64aad913e16d7e6008aa6ca06cf3f1b6fa864c4a/test/test_keyword.rb#L15
1 parent 2c8f9b4 commit 9a83da1

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/main/ruby/truffleruby/core/truffle/kernel_operations.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def self.define_read_only_global(name, getter)
3434
LOAD_PATH = Truffle::SynchronizedArray.new
3535
LOADED_FEATURES = Truffle::SynchronizedArray.new
3636

37+
# Always provided features: ruby --disable-gems -e 'puts $"'
38+
LOADED_FEATURES << 'ruby2_keywords.rb'
39+
3740
define_read_only_global(:$LOAD_PATH, -> { LOAD_PATH })
3841
define_read_only_global(:$LOADED_FEATURES, -> { LOADED_FEATURES })
3942

src/main/ruby/truffleruby/post-boot/post-boot.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
if path.start_with?(old_home)
4747
path.replace Truffle::Ropes.flatten_rope(path[old_home.size..-1])
4848
paths_starting_with_home << path
49+
elsif !path.include?('/')
50+
# relative path for always provided features like 'ruby2_keywords.rb'
4951
else
5052
raise "Path #{path.inspect} in $LOAD_PATH or $LOADED_FEATURES was expected to start with #{old_home}"
5153
end

0 commit comments

Comments
 (0)