Reputation: 15634
Is it safe to unlink a file in ruby in Linux without closing it first? Does it matter?
Upvotes: 1
Views: 1798
Reputation: 37945
On linux this is safe and is often used to create undiscoverable temporary files.
You can read and write from and to the file as long as you have it opened, whether it was deleted or not is irrelevant. The file will truly disappear when you close it AND delete it, no matter the order.
Upvotes: 4