[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36
John Goerzen
jgoerzen at complete.org
Fri Apr 23 15:02:37 UTC 2010
The following commit has been merged in the master branch:
commit ead8b9034319bf86959207f89ac3a2d29b8be1b8
Author: John Goerzen <jgoerzen at complete.org>
Date: Wed Sep 28 23:53:42 2005 +0100
Added logging to daemon
diff --git a/MissingH/Daemon.hs b/MissingH/Daemon.hs
index 2764b02..b0f9ace 100644
--- a/MissingH/Daemon.hs
+++ b/MissingH/Daemon.hs
@@ -54,9 +54,12 @@ where
import System.Posix.Process
import System.Posix.IO
import System.Directory
+import MissingH.Logging.Logger
#ifndef mingw32_HOST_OS
+trap = traplogging "MissingH.Daemon" ERROR "detachDaemon"
+
{- | Detach the process from a controlling terminal and run it in the
background, handling it with standard Unix deamon semantics.
@@ -75,16 +78,18 @@ Note that this is not intended for a daemon invoked from inetd(1).
-}
detachDaemon :: IO ()
-detachDeamon = forkProcess child1 >> exitImmediately ExitSuccess
+detachDeamon = trap $
+ do forkProcess child1
+ exitImmediately ExitSuccess
child1 :: IO ()
-child1 =
+child1 = trap $
do createSession
forkProcess child2
exitImmediately ExitSuccess
child2 :: IO ()
-child2 =
+child2 = trap $
do setCurrentDirectory "/"
mapM_ closeFd [stdInput, stdOutput, stdError]
nullFd <- openFd "/dev/null" ReadWrite Nothing defaultFileFlags
@@ -92,4 +97,4 @@ child2 =
closeFd nullFd
-#endif
\ No newline at end of file
+#endif
--
haskell-testpack
More information about the Pkg-haskell-commits
mailing list