Commit 12cdd6da authored by Duncan Coutts's avatar Duncan Coutts
Browse files

Don translate UserInterrupt into ExitFailure 1, let it propagate

It is important that if a program recieved ^C from the user, and the
program terminates as a result, that it exit with SIGINT so that the
parent process knows that was the case. For example cabal calling ghc
will then be able to tell the difference between it failing and the user
interrupting with ^C and report (or not) appropriately.

So we should just let the UserInterrupt exception propagate to the top
level error handler which will do the right thing.

See http://www.cons.org/cracauer/sigint.html
parent a987b800
......@@ -344,7 +344,10 @@ defaultErrorHandler fm (FlushOut flushOut) inner =
Just (ioe :: IOException) ->
fatalErrorMsg'' fm (show ioe)
_ -> case fromException exception of
Just UserInterrupt -> exitWith (ExitFailure 1)
Just UserInterrupt ->
-- Important to let this one propagate out so our
-- calling process knows we were interrupted by ^C
liftIO $ throwIO UserInterrupt
Just StackOverflow ->
fatalErrorMsg'' fm "stack overflow: use +RTS -K<size> to increase it"
_ -> case fromException exception of
......
Markdown is supported
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