- let handleEval (ExitException code) = io (exitWith code)
- handleEval e = handler e
- runCommands' handleEval (return Nothing)
+ let handle e = do st <- getGHCiState
+ -- Jump through some hoops to get the
+ -- current progname in the exception text:
+ -- <progname>: <exception>
+ io $ withProgName (progname st)
+ -- The "fast exit" part just calls exit()
+ -- directly instead of doing an orderly
+ -- runtime shutdown, otherwise the main
+ -- GHCi thread will complain about being
+ -- interrupted.
+ $ topHandlerFastExit e
+ runCommands' handle (return Nothing)