On Nov 13, 2008, at 9:24 AM, Gisle Aas wrote:
>
> On Nov 13, 2008, at 20:04 , David Golden wrote:
>
>> On Thu, Nov 13, 2008 at 1:03 PM, Gisle Aas <gisle@activestate.com>
>> wrote:
>>> On Nov 13, 2008, at 18:10 , David Golden wrote:
>>>> On Wed, Nov 12, 2008 at 8:43 PM, Tim Jenness <t.jenness@jach.hawaii.edu
>>>> >
>>>> wrote:
>>>>>
>>>>> Should I simply put an eval around the rmtree? Or does that
>>>>> sound too
>>>>> simplistic?
>>>>
>>>> I would go ahead and do that, even if File::Path is fixed since
>>>> people
>>>> might upgrade File::Temp and not File::Path.
>>>
>>> I don't think I would recommend that. File::Path actually tries
>>> to croak if
>>> you try do delete the current directory before it starts deleting,
>>> so if you
>>> just put an eval around it it will just silently fail (under the
>>> right
>>> conditions).
>>
>> That's my point. There are possible reasons why temporary
>> files/directories can't be deleted on various platforms -- I'm most
>> familiar with Win32, where files open files inside the temporary
>> directory prevent removal, etc. This can happen due to virus scanners
>> operating, directory indexing, etc. I even think that I've had
>> directory removal be hosed because the OS hadn't finished deleting
>> files yet. (Hackery: delete files, sleep 2 seconds, delete
>> directory.) It's ugly stuff.
>>
>> Because File::Temp cleanup is 'magic' -- happening behind the scenes
>> of a program -- for it to be "user-friendly" in my view, it should
>> make a best-efforts attempt to clean up files/folders (assuming it's
>> set to do so), but should not have failure to remove them be fatal to
>> the ongoing execution of the program -- they are, after all,
>> temporary, and eventually leftover temporary files/directories can be
>> removed by the OS or the user.
>
> That's fair enough. I just think it might be a bad idea to totally
> silence the rmtree() errors that might occur. Something like this
> might be better:
>
> eval { rmtree($dir) }; warn $@ if $@ && $^W;
>
That seems fine with me. I'll put together a new release.
--
Tim Jenness
Joint Astronomy Centre