[project @ 2005-01-28 14:55:05 by simonmar]
[ghc-base.git] / GHC / TopHandler.lhs
index 186fd8e..829752e 100644 (file)
@@ -29,7 +29,7 @@ import GHC.Prim (unsafeCoerce#)
 
 -- | 'runMainIO' is wrapped around 'Main.main' (or whatever main is
 -- called in the program).  It catches otherwise uncaught exceptions,
--- and also flushes stdout/stderr before exiting.
+-- and also flushes stdout\/stderr before exiting.
 runMainIO :: IO a -> IO a
 runMainIO main = (do a <- main; cleanUp; return a) `catchException` topHandler
 
@@ -58,6 +58,7 @@ topHandler err = catchException (real_handler err) topHandler
 --
 real_handler :: Exception -> IO a
 real_handler ex =
+  cleanUp >>
   case ex of
        AsyncException StackOverflow -> do
           reportStackOverflow