Skip to content

Commit 418676f

Browse files
committed
rake sync_tool
1 parent 5001c32 commit 418676f

2 files changed

Lines changed: 18 additions & 3 deletions

File tree

‎lib/core_assertions.rb‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,10 @@ def assert_separately(args, file = nil, line = nil, src, ignore_stderr: nil, **o
362362
#{line -= __LINE__; src}
363363
eom
364364
args = args.dup
365-
args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"})
365+
# -W:no-experimental after the -w, which would otherwise turn the category
366+
# back on. The option itself needs 2.7 or later.
367+
warn_opts = RUBY_VERSION >= "2.7." ? ["-w", "-W:no-experimental"] : ["-w"]
368+
args.insert((Hash === args.first ? 1 : 0), *warn_opts, "--disable=gems", *$:.map {|l| "-I#{l}"})
366369
args << "--debug" if RUBY_ENGINE == 'jruby' # warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag
367370
# power_assert 3 requires ruby 3.1 or later
368371
args << "-W:no-experimental" if ("2.7."..."3.1.").cover?(RUBY_VERSION)

‎lib/envutil.rb‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ def rubybin
4343

4444
RUBYLIB = ENV["RUBYLIB"]
4545

46+
# Ruby::Box prints this at startup of every child process when RUBY_BOX=1
47+
# is inherited from the environment.
48+
BOX_EXPERIMENTAL_WARNING = /^.*: warning: Ruby::Box is experimental, and the behavior may change in the future!\nSee https:\/\/docs\.ruby-lang\.org\/\S+ for known issues, etc\.\n/
49+
50+
def strip_box_warning(str)
51+
# on the bytes, since captured output is not always valid in its encoding
52+
str.b.gsub(BOX_EXPERIMENTAL_WARNING, "").force_encoding(str.encoding) if str
53+
end
54+
module_function :strip_box_warning
55+
4656
class << self
4757
attr_accessor :timeout_scale
4858
attr_reader :original_internal_encoding, :original_external_encoding,
@@ -266,6 +276,10 @@ def invoke_ruby(args, stdin_data = "", capture_stdout = false, capture_stderr =
266276
out_p.close if capture_stdout
267277
err_p.close if capture_stderr && capture_stderr != :merge_to_stdout
268278
status ||= Process.wait2(pid)[1]
279+
if ENV["RUBY_BOX"] == "1" and !child_env.key?("RUBY_BOX")
280+
stdout = strip_box_warning(stdout) if capture_stderr == :merge_to_stdout
281+
stderr = strip_box_warning(stderr)
282+
end
269283
stdout = stdout_filter.call(stdout) if stdout_filter
270284
stderr = stderr_filter.call(stderr) if stderr_filter
271285
if timeout_error
@@ -351,8 +365,6 @@ def under_gc_stress(stress = true)
351365
module_function :under_gc_stress
352366

353367
def under_gc_compact_stress(val = :empty, &block)
354-
raise "compaction doesn't work well on s390x. Omit the test in the caller." if RUBY_PLATFORM =~ /s390x/ # https://github.com/ruby/ruby/pull/5077
355-
356368
if GC.respond_to?(:auto_compact)
357369
auto_compact = GC.auto_compact
358370
GC.auto_compact = val

0 commit comments

Comments
 (0)