[darcs-users] darcs patch: Handle empty files in mmapFilePS. Also cater for FD sh...

Judah Jacobson judah.jacobson at gmail.com
Thu Feb 5 08:29:14 UTC 2009


On Thu, Feb 5, 2009 at 12:24 AM, Petr Rockai <me at mornfall.net> wrote:
> Judah Jacobson <judah.jacobson at gmail.com> writes:
>> I think the below code might be slightly cleaner:
>>
>> x <- unsafeMMapFile `catch` $ \e -> do
>>         size <- fileSize `fmap` getSymbolicLinkStatus f
>>         if size == 0
>>             then return B.empty
>>             else throwIO e
>>
>> That is, explicitly re-throw the caught exception, rather than calling
>> unsafeMMapFile again to get it implicitly re-thrown.
> The idea is that after performGC, there is a reasonable chance that the second
> call will actually succeed.

Ah, neat, I get it.  Thanks for the explanation.
-Judah


More information about the darcs-users mailing list