From 8712ac7b38fe14b4dfdb382a897960deebc53c75 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 10 Sep 2025 10:13:07 -0400 Subject: [PATCH] Fix tempfile leaking in TestRequire The test introduced in 928fea3 is leaking files because the Tempfile is not cleaned when the process exits. We see this in the output: Children under /var/folders/51/_yzlsvf96v9729jtj8_mcp7w0000gn/T/rubytest.7lbdlp: * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-g4op87.rb * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-pu621v.rb * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-4xv688.rb * -rw------- 1 0 2025-09-10 10:09:51 -0400 test20250910-13775-1rvp4b.rb --- test/ruby/test_require.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 3b6cc1178d..4f6c62dc35 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -857,7 +857,7 @@ class TestRequire < Test::Unit::TestCase def to_path = @path end - def create_ruby_file = Tempfile.create(["test", ".rb"]).path + def create_ruby_file = Tempfile.open(["test", ".rb"]).path require MyString.new(create_ruby_file) $LOADED_FEATURES.unshift(create_ruby_file)