summaryrefslogtreecommitdiff
path: root/test/test_tempfile.rb
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2024-08-15 12:17:12 -0400
committergit <[email protected]>2024-08-20 13:28:36 +0000
commit41b427a2648ed2e049952450c698be917e0bb125 (patch)
tree6144f00544fb299191d7a2d3b07ac2ca9c5bf58f /test/test_tempfile.rb
parentd6f18b226ef51e71bea72eb888fa42bd0f74bc57 (diff)
[ruby/tempfile] Ensure finalizer order in Tempfile
The Closer and Remover finalizers are defined on different objects in Tempfile. The Closer is defined on the Tempfile object while the Remover is defined on the finalizer_obj. This means that there is no guarantee of the finalizer order. On Windows, we must close the file before removing it because we cannot remove an open file. But since the order is not guaranteed, the GC may run the Remover finalizer first, which will fail with an Errno::EACCES (Permission denied @ apply2files). This commit changes it so that both the Closer and Remover finalizers are defined on the finalizer_obj, which guarantees the order that it is ran. https://github.com/ruby/tempfile/commit/eb2d8b1175
Diffstat (limited to 'test/test_tempfile.rb')
0 files changed, 0 insertions, 0 deletions