Skip to content

Commit

Permalink
Avoid load errors on boot.
Browse files Browse the repository at this point in the history
The operating_system.rb file just loads our regular jruby.rb
defaults, avoiding the LoadError. We search for the native
launcher defaults before attempting to load them.
# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is up-to-date with 'origin/master'.
#
# Changes to be committed:
#	modified:   lib/ruby/stdlib/rubygems/defaults/jruby.rb
#	new file:   lib/ruby/stdlib/rubygems/defaults/operating_system.rb
#
# Untracked files:
#	COMMIT_EDITMSG
#	bench1.rb
#	bench2.rb
#	blah
#	blah.rb
#	blah.sh
#	blah2.rb
#	jruby_jetpdb/
#	link20180108-44247-163yxpr
#	link20180109-64370-163yxpr
#	link20180109-81753-163yxpr
#	link20180109-82366-163yxpr
#	link20180109-82784-163yxpr
#	link20180109-83276-163yxpr
#	nic.rb
#	ripper_bug_4792.rb
#	run_jruby.sh
#	test/jruby/tcttac37356-0.jpg
#	test/jruby/testapp/testapp
#	test_thr_kill_count
#	testapp2/
#	tmp/
#	var/
#	"\316\261.rb"
#	"\343\201\202"
#
headius committed Jan 9, 2018
1 parent e390180 commit 9f46710
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ruby/stdlib/rubygems/defaults/jruby.rb
Original file line number Diff line number Diff line change
@@ -117,7 +117,9 @@ def self.uid
# indicates the native launcher is installed and will override
# env-shebang and possibly other options.
begin
require 'rubygems/defaults/jruby_native'
if File.exist?(File.join(File.dirname(__FILE__), "jruby_native.rb"))
require 'rubygems/defaults/jruby_native'
end
rescue LoadError
end

4 changes: 4 additions & 0 deletions lib/ruby/stdlib/rubygems/defaults/operating_system.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# In order to avoid the exception from failing to load this file in rubygems.org,
# we just require our actual defaults file here. Repackagers may modify this file
# to do system-specific things.
require 'rubygems/defaults/jruby'

1 comment on commit 9f46710

@headius
Copy link
Member Author

@headius headius commented on 9f46710 Jan 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh.

Please sign in to comment.