summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2019-05-30 23:16:27 -0400
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-05-31 14:38:35 +0900
commitea42423908ed055f9039b1dce6e9a232a3b2dd90 (patch)
treef6b404f83fa411b8e1ef696bead7beab8d331b02 /test/ruby/test_process.rb
parent83f9183a7e549b0d7e6b68e298d57744ddb4d97f (diff)
Keep vm->orig_progname alive
`vm->orig_progname` can be different from `vm->progname` when user code assigns to `$0`. While `vm->progname` is kept alive by the global table, nothing marked `vm->orig_progname`. [Bug #15887]
Diffstat (limited to 'test/ruby/test_process.rb')
-rw-r--r--test/ruby/test_process.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index ba7126912b..fb3f50a573 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -1400,6 +1400,14 @@ class TestProcess < Test::Unit::TestCase
}
end
+ def test_argv0_keep_alive
+ assert_in_out_err([], <<~REPRO, ['-'], [], "[Bug #15887]")
+ $0 = "diverge"
+ 4.times { GC.start }
+ puts Process.argv0
+ REPRO
+ end
+
def test_status
with_tmpchdir do
s = run_in_child("exit 1")