This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap".

The branch, hint-fix has been updated
       via  5b541f35d8f7b85ddc67dfe9f38a4bc69b8b52a7 (commit)
      from  c7ee77706530c2dbc85362c4061abe67350c6bd2 (commit)


Summary of changes:
 snap.cabal                     |    2 +-
 src/Snap/Loader/Hint/Helper.hs |   43 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletions(-)
 create mode 100644 src/Snap/Loader/Hint/Helper.hs

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5b541f35d8f7b85ddc67dfe9f38a4bc69b8b52a7
Author: Carl Howells <[email protected]>
Date:   Tue Dec 14 12:27:02 2010 -0800

    whitespace

diff --git a/snap.cabal b/snap.cabal
index fbb719e..7a1c5f8 100644
--- a/snap.cabal
+++ b/snap.cabal
@@ -39,7 +39,7 @@ extra-source-files:
   project_template/default/src/Snap/Extension/Timer,
   project_template/default/src/Snap/Extension/Timer/Timer.hs,
   project_template/default/src/Snap/Extension/Timer.hs
-  
+
 Library
   hs-source-dirs: src
 
diff --git a/src/Snap/Loader/Hint/Helper.hs b/src/Snap/Loader/Hint/Helper.hs
new file mode 100644
index 0000000..361c2d4
--- /dev/null
+++ b/src/Snap/Loader/Hint/Helper.hs
@@ -0,0 +1,43 @@
+{-# LANGUAGE CPP #-}
+module Snap.Loader.Hint.Helper (protectHandlers) where
+
+import Control.Exception (bracket)
+
+#ifdef mingw32_HOST_OS
+import GHC.ConsoleHandler as C
+
+
+saveHandlers :: IO C.Handler
+saveHandlers = C.installHandler Ignore
+
+
+restoreHandlers :: C.Handler -> IO C.Handler
+restoreHandlers = C.installHandler
+
+
+#else
+import qualified System.Posix.Signals as S
+
+helper :: S.Handler -> S.Signal -> IO S.Handler
+helper handler signal = S.installHandler signal handler Nothing
+
+
+signals :: [S.Signal]
+signals = [ S.sigQUIT
+          , S.sigINT
+          , S.sigHUP
+          , S.sigTERM
+          ]
+
+
+saveHandlers :: IO [S.Handler]
+saveHandlers = mapM (helper S.Ignore) signals
+
+
+restoreHandlers :: [S.Handler] -> IO [S.Handler]
+restoreHandlers h = sequence $ zipWith helper h signals
+
+
+#endif
+protectHandlers :: IO a -> IO a
+protectHandlers a = bracket saveHandlers restoreHandlers $ const a
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to