Put -W:no-experimental after whatever RUBYOPT already carries

The last -W switch wins, so prepending it left an inherited -w or -W2 in
control and the suppression quietly did nothing.  `make test-all
RUBYOPT=-w` reproduces it: under `RUBY_BOX=1` test_open3.rb and
test_pty.rb stay at 12 and 4 failures, and reach 0 once the switch moves
behind the inherited options and in front of the bare "-".

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hiroshi SHIBATAandClaude Opus 5 committed 2026-09-10 14:07:00 +09:00
1 parent fa16f8118a
commit 0a30fd9cc6
2 files changed
+11 -5
Notes: git 2026-09-10 05:07:41 +00:00

No files matched your search

+5 -2
View File
@@ -3,8 +3,11 @@ $VERBOSE = false
if (opt = ENV["RUBYOPT"]) and (opt = opt.dup).sub!(/(?:\A|\s)-w(?=\z|\s)/, '')
ENV["RUBYOPT"] = opt
end
# The specs assert the output of the ruby processes they spawn verbatim.
ENV["RUBYOPT"] = (["-W:no-experimental"] | ENV["RUBYOPT"].to_s.split).join(" ")
# The specs assert the output of the ruby processes they spawn verbatim. See
# tool/test/init.rb for why the switch goes where it does.
rubyopt = ENV["RUBYOPT"].to_s.split - ["-W:no-experimental"]
rubyopt.insert(rubyopt.index("-") || rubyopt.size, "-W:no-experimental")
ENV["RUBYOPT"] = rubyopt.join(" ")
# Enable constant leak checks by ruby/mspec
ENV["CHECK_CONSTANT_LEAKS"] ||= "true"
+6 -3
View File
@@ -14,9 +14,12 @@ ENV.delete("RUBY_CODESIGN")
Warning[:experimental] = false
# The tests assert the output of the ruby processes they spawn verbatim, so the
# children need this too. It has to precede the bare "-" that common.mk puts in
# RUBYOPT, which ends the option scan.
ENV["RUBYOPT"] = (["-W:no-experimental"] | ENV["RUBYOPT"].to_s.split).join(" ")
# children need this too. The last -W wins, so the switch has to come after
# whatever RUBYOPT already carries, but before the bare "-" that common.mk puts
# there, which ends the option scan.
rubyopt = ENV["RUBYOPT"].to_s.split - ["-W:no-experimental"]
rubyopt.insert(rubyopt.index("-") || rubyopt.size, "-W:no-experimental")
ENV["RUBYOPT"] = rubyopt.join(" ")
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)