From: Robert Klemme Date: 2009-02-06T05:09:31+09:00 Subject: Re: File.delete one-liner On 05.02.2009 18:49, Joel VanderWerf wrote: > Robert Klemme wrote: >> 2009/2/4 Julian Leviston : >>> File.delete(File.exists?(lockfile) ? lockfile : @lockfile) >> [lockfile, @lockfile].any? {|f| File.delete(f) rescue false} > > If #delete fails on lockfile for some reason other than ENOENT, this > code will try to delete @lockfile. This is correct. I thought that was intended. Didn't you suggest exactly this in your previous posting (atomic deletion)? Looking at the original question it is not clear in which cases @lockfile should be deleted - unless you take the code as spec. Thanks for pointing this out! Cheers robert