mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-12 01:22:01 +03:00
19 lines
609 B
Idris
19 lines
609 B
Idris
|
import System.Signal
|
||
|
import System
|
||
|
|
||
|
main : IO ()
|
||
|
main = do
|
||
|
Right () <- collectSignal SigABRT
|
||
|
| Left (Error code) => putStrLn $ "error " ++ (show code)
|
||
|
putStrLn "before"
|
||
|
Right () <- raiseSignal SigABRT
|
||
|
| Left (Error code) => putStrLn $ "got non-zero exit from system call: " ++ (show code)
|
||
|
sleep 1
|
||
|
Just SigABRT <- handleNextCollectedSignal
|
||
|
| Just _ => putStrLn "received the wrong signal."
|
||
|
| Nothing => putStrLn "did not receive expected signal."
|
||
|
putStrLn "after"
|
||
|
Right () <- defaultSignal SigABRT
|
||
|
| Left (Error code) => putStrLn $ "error " ++ (show code)
|
||
|
putStrLn "done."
|