From 1bed54dcf7e369eac040fbfab629983cf0eaaaea Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 20 Apr 2024 19:45:01 +0900 Subject: [PATCH] Clear temporary directory --- test/zlib/test_zlib.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/zlib/test_zlib.rb b/test/zlib/test_zlib.rb index 502ccce..ae4adc2 100644 --- a/test/zlib/test_zlib.rb +++ b/test/zlib/test_zlib.rb @@ -801,7 +801,8 @@ def test_path_tmpfile gz.write "hi" gz.close - File.open(Dir.mktmpdir, File::RDWR | File::TMPFILE) do |io| + tmpdir = Dir.mktmpdir("zlib_file_tmpfile") + File.open(tmpdir, File::RDWR | File::TMPFILE) do |io| io.write sio.string io.rewind @@ -825,6 +826,8 @@ def test_path_tmpfile omit 'O_TMPFILE not supported (EISDIR)' rescue Errno::EOPNOTSUPP omit 'O_TMPFILE not supported (EOPNOTSUPP)' + ensure + Dir.rmdir(tmpdir) if tmpdir end end end