diff options
| author | Peter Zhu <peter@peterzhu.ca> | 2025-09-10 10:13:07 -0400 |
|---|---|---|
| committer | Peter Zhu <peter@peterzhu.ca> | 2025-09-10 13:37:16 -0400 |
| commit | 8712ac7b38fe14b4dfdb382a897960deebc53c75 (patch) | |
| tree | df750f91e5377c19cae1ddd90180e564c2eb5d5f /test/ruby/test_require.rb | |
| parent | 13c2f8d5c2b41ec78344ae60f9b5ec1564029418 (diff) | |
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
Diffstat (limited to 'test/ruby/test_require.rb')
| -rw-r--r-- | test/ruby/test_require.rb | 2 |
1 files changed, 1 insertions, 1 deletions
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) |
