Skip to content

Commit 15b2f00

Browse files
committed
JRuby does not have EXECUTABLE_EXTS in RbConfg::CONFIG
1 parent 740ffa7 commit 15b2f00

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/optparse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ def program_name
13001300
private def strip_ext(name) # :nodoc:
13011301
exts = /#{
13021302
require "rbconfig"
1303-
Regexp.union(RbConfig::CONFIG["EXECUTABLE_EXTS"])
1303+
Regexp.union(*RbConfig::CONFIG["EXECUTABLE_EXTS"]&.split(" "))
13041304
}\z/o
13051305
name.sub(exts, "")
13061306
end

test/optparse/test_optparse.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def test_program_name
221221
program = $0
222222
$0 = "rdbg3.5"
223223
assert_equal "rdbg3.5", OptionParser.new.program_name
224-
RbConfig::CONFIG["EXECUTABLE_EXTS"].split(" ") do |ext|
224+
RbConfig::CONFIG["EXECUTABLE_EXTS"]&.split(" ") do |ext|
225225
$0 = "rdbg3.5" + ext
226226
assert_equal "rdbg3.5", OptionParser.new.program_name
227227
end

0 commit comments

Comments
 (0)