2021-05-25 18:45:46 +03:00
|
|
|
import System.Signal
|
|
|
|
import System
|
|
|
|
import Data.List
|
|
|
|
import Data.Fuel
|
|
|
|
|
|
|
|
main : IO ()
|
|
|
|
main = do
|
|
|
|
Right () <- collectSignal SigABRT
|
|
|
|
| Left (Error code) => putStrLn $ "error " ++ (show code)
|
2021-07-13 14:03:06 +03:00
|
|
|
Right () <- collectSignal SigILL
|
|
|
|
| Left (Error code) => putStrLn $ "error " ++ (show code)
|
2021-05-25 18:45:46 +03:00
|
|
|
putStrLn "before"
|
|
|
|
[Right (), Right (), Right ()] <- sequence $ replicate 3 (raiseSignal SigABRT)
|
|
|
|
| _ => putStrLn $ "got non-zero exit from a system call"
|
2021-07-13 14:03:06 +03:00
|
|
|
[Right (), Right (), Right ()] <- sequence $ replicate 3 (raiseSignal SigILL)
|
|
|
|
| _ => putStrLn $ "got non-zero exit from a system call"
|
2021-05-25 18:45:46 +03:00
|
|
|
sleep 1
|
2021-07-13 14:03:06 +03:00
|
|
|
[SigILL, SigABRT] <- handleManyCollectedSignals (limit 4)
|
|
|
|
| (_ :: _ :: []) => putStrLn "received the wrong signals."
|
2021-05-25 18:45:46 +03:00
|
|
|
| _ => putStrLn "did not receive expected number of signals."
|
|
|
|
putStrLn "after"
|
|
|
|
Right () <- defaultSignal SigABRT
|
|
|
|
| Left (Error code) => putStrLn $ "error " ++ (show code)
|
|
|
|
putStrLn "done."
|