On Thu, Aug 20, 2009 at 8:52 PM, Yukihiro Matsumoto<matz / ruby-lang.org> wro=
te:
> Hi,
>
> In message "Re: [ruby-core:25011] Re: [Bug #1494] tempfile#unlink may sil=
ently fail on windows"
> =A0 =A0on Fri, 21 Aug 2009 08:37:35 +0900, Nobuyoshi Nakada <nobu@ruby-la=
ng.org> writes:
>
> |At Fri, 21 Aug 2009 07:36:27 +0900,
> |Shyouhei Urabe wrote in [ruby-core:25008]:
> |>
> |> Matz, can I revert this? =A0Or do you want to do so?
> |
> |I'd vote for Luis's suggestion.
>
> I am not sure what he exactly wants, and what would happen on Windows.
> But if you think it's OK, please check in the fix.
>

Hello Matz,

Basically as Jeremy Kemper pointed, the current 1.9.x implementation is fla=
wed.

On this thread:
http://groups.google.com/group/rack-devel/browse_thread/thread/a2aab3a4720f=
34c4

A workaround is use "better" external dependency to override Ruby's
one, which has been mentioned in the above thread and it's on GitHub:

http://github.com/FooBarWidget/better/blob/master/lib/better/tempfile.rb#L2=
8

More precisely, the approach shown here:

http://github.com/FooBarWidget/better/blob/master/lib/better/tempfile.rb#L3=
28-340

Seems to rescue Errno::EACCES on Windows, and silently fail.

On our scenario (Windows), that will leave open descriptors.

My suggestion was: if we are now taking the time to rescue that
exception why we don't actually solve the issue?

    rescue Errno::EACCES
      close
      retry
    end

In theory that will reduce lot of Errno:EACCES and platform specific
conditions in end-users scripts.

The only thing under this could fail is if another process has locked
that file too.

--=20
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exup=E9ry