finally part run twice on Ctrl-C

Philip K.F. Hölzenspies p.k.f.holzenspies at utwente.nl
Fri Feb 27 03:37:18 EST 2009


> I've got the following code:
>
> import Control.Exception
> import System.Cmd
> main = system "sleep 1m" `finally` putStrLn "goodbye"
>
> When compiled with GHC 6.10.1.20090225, if I hit Ctrl-C during the
> sleep, I get the goodbye printed twice. If I leave evaluation to
> finish normally I get goodbye once. Is this a bug?

Dear Neil, et al.

Just to let you know; I tried it on the release version of 6.10.1 and it 
worked as expected (first run, I waited; second I pressed Ctrl-C):

*Test> main
goodbye
ExitSuccess
*Test> main
goodbye
ExitFailure 2
*Test>

If not coming from system differences, the bug should sit in recent code.

Regards,
Philip


More information about the Glasgow-haskell-users mailing list