Commit 2dbdcc36 authored by Simon Marlow's avatar Simon Marlow
Browse files

fix for GHCi tests that raise exceptions or exit

We need to call GHC.TopHandler.runIOFastExit instead of
GHC.TopHandler.runIO.  Recent fixes to the shutdown code have meant
that when a thread invokes shutdownHaskellAndExit(), other main
threads get a chance to exit (as they should), but this means that we
might have a race between the child thread trying to exit the program
and the main thread doing the same.  In the case of GHCi, if we're
running an interpreted computation that needs to exit (as some tests
do), then we really want this child thread to exit the program rather
than the main thread.
parent 0998d4fb
......@@ -727,7 +727,7 @@ def interpreter_run( name, way, extra_hc_opts, compile_only, top_mod ):
script.write('System.IO.hSetBuffering System.IO.stdout System.IO.LineBuffering\n')
# wrapping in GHC.TopHandler.runIO ensures we get the same output
# in the event of an exception as for the compiled program.
script.write('GHC.TopHandler.runIO Main.main Prelude.>> Prelude.return ()\n')
script.write('GHC.TopHandler.runIOFastExit Main.main Prelude.>> Prelude.return ()\n')
# figure out what to use for stdin
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment