[Backport #21638] Mark ractor-local $VERBOSE and $DEBUG

https://github.com/sampersand/blog/blob/master/the%20-s%20flag.md#the-segfault
This commit is contained in:
Nobuyoshi Nakada 2025-10-14 12:38:52 +09:00 committed by Takashi Kokubun
parent c26a2b12e1
commit f2fd5b3bc2
2 changed files with 4 additions and 0 deletions

View File

@ -217,6 +217,8 @@ ractor_mark(void *ptr)
rb_gc_mark(r->r_stdin);
rb_gc_mark(r->r_stdout);
rb_gc_mark(r->r_stderr);
rb_gc_mark(r->verbose);
rb_gc_mark(r->debug);
rb_hook_list_mark(&r->pub.hooks);
if (r->threads.cnt > 0) {

View File

@ -573,6 +573,8 @@ class TestRubyOptions < Test::Unit::TestCase
assert_in_out_err(%w(- -#=foo), "#!ruby -s\n", [],
/invalid name for global variable - -# \(NameError\)/)
assert_in_out_err(['-s', '-e', 'GC.start; p $DEBUG', '--', '-DEBUG=x'], "", ['"x"'])
end
def test_option_missing_argument