Skip to content

exception handling: exitWith ExitSuccess results in abnormal termination with Control.OldException

Consider this program.

import System.Exit
import Control.OldException

main = exitWith ExitSuccess `finally` return ()

It should not produce any output and return 0 as its exit code. Instead we get:

# runhaskell test.hs
exit: ExitSuccess
# echo $?
1

The problem is that finally catches the exception and rethrows it. In the process, the OldException module maps exceptions to old exceptions, but never maps them back when they're thrown.

Trac metadata
Trac field Value
Version 6.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information