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