blob: 0ee4bcb1ce18da4002599ff7408838d9aa2b324d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
import System.Posix.Process
import System.Posix.Signals
import Control.Exception
import Control.Concurrent
-- Test that a simulated ^C sends an async UserInterrupt
-- exception to the main thread.
main = handle userInterrupt $ do
us <- getProcessID
signalProcess sigINT us
threadDelay 1000000
putStrLn "Fail: never received exception"
userInterrupt UserInterrupt = putStrLn "Success: caught UserInterrupt"
userInterrupt e = putStrLn "Fail: caught unexpected exception"
|