Skip to content

Instantly share code, notes, and snippets.

@fujimura
Last active March 22, 2016 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fujimura/d204d864645160136bdc to your computer and use it in GitHub Desktop.
Save fujimura/d204d864645160136bdc to your computer and use it in GitHub Desktop.
import System.Posix.Signals
import Control.Concurrent
main :: IO ()
main = do
m <- newEmptyMVar
installHandler sigKILL (Catch (putMVar m "Hi")) Nothing
installHandler keyboardSignal (Catch (putMVar m "Hi")) Nothing
takeMVar m >>= print
@fujimura
Copy link
Author

$  runghc a.hs
a.hs: sigaction
^C"Hi"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment