Malcolm Wallace wrote:
Simon Marlow <marlo...@gmail.com> wrote:

stdout should be flushed when the program exits, regardless of whether
it  exits as a result of a clean exit or an exception.  I've just
checked the code, and that's certainly what is supposed to happen. If anyone has evidence to the contrary, please submit a bug report!

I believe flushing of file handles on program exit is handled by
finalizers attached to the handle.  Until recently, ghc did not
guarantee that any finalizer would ever run.

Not exactly.

There's a top-level exception handler that flushes stdout and stderr, so they always get flushed on exit (or at least, they are supposed to). Look in base:GHC.TopHandler for the code.

Other handlers will only get flushed if their finalizers run, and nothing has changed here: we now guarantee execution of C finalizers, but that doesn't apply to the finalizers for Handles, which are Haskell code.

Cheers,
        Simon

_______________________________________________
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to