[darcs-users] [patch310] Resolve issue 1599: automatically expire unused caches
Adolfo Builes
builes.adolfo at googlemail.com
Tue Aug 3 05:53:18 UTC 2010
Hi Eric,
I'm almost done write the modifications with the patch, I have a small
issue though, with:
>
> REMARK: An alternative approach may be to register this as an exit
> action via atexit, which seems a bit cleaner/more modular to me. I
> guess the component that would register this would be the main function
> for darcs. On the other hand, I suppose one advantage of baking this
> into withAtExit is that we control the order of execution; this fires
> after all the actions have been run. Are there other reasons? If we
> don't care about the order of execution so much, I'd lean more towards
> the more modular approach
>
I register the action using atexit, and it works, but happens that it
calls the action twice, so I end with the message repeated.
This is the part where I added the atexit
hunk ./src/darcs.hs 54
+ atexit reportBadSources
hunk ./src/darcs.hs 77
-
+ where
+ reportBadSources = do
+ sources <- getBadSourcesList
+ when ( not $ null sources ) $ do
+ hPutStderr $ "\nI could not reach the following " ++
+ englishNum (length sources) (Noun "repository") ":"
+ hPutStderr $ (unlines sources) ++ "If you're not using " ++
+ englishNum (length sources) Pronoun ", you should
probably delete\nthe corresponding " ++
+ englishNum (length sources) (Noun "entry") " from
_darcs/prefs/sources."
+ hPutStderr = hPutStrLn stderr
Maybe any idea what is going on and why the action gets called twice ?.
--
Adolfo
More information about the darcs-users
mailing list