hdaemonize 0.4.1 → 0.4.2
raw patch · 2 files changed
+14/−5 lines, 2 filesdep +mtlPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: mtl
API changes (from Hackage documentation)
+ System.Posix.Daemonize: exitCleanly :: (MonadIO m) => m a
- System.Posix.Daemonize: fatalError :: String -> IO a
+ System.Posix.Daemonize: fatalError :: (MonadIO m) => String -> m a
Files
- System/Posix/Daemonize.hs +12/−3
- hdaemonize.cabal +2/−2
System/Posix/Daemonize.hs view
@@ -5,7 +5,7 @@ -- * Building system services serviced, CreateDaemon(..), simpleDaemon, -- * Intradaemon utilities - fatalError+ fatalError, exitCleanly -- * An example -- -- | Here is an example of a full program which writes a message to@@ -45,6 +45,7 @@ http://sneakymustard.com/2008/12/11/haskell-daemons -} +import Control.Monad.Trans import Control.Exception.Extensible import qualified Control.Monad as M (forever) import Prelude hiding (catch)@@ -320,8 +321,16 @@ -- is to write an error to the log and die messily, use fatalError. -- This is a good candidate for things like not being able to find -- configuration files on startup.-fatalError :: String -> IO a-fatalError msg = do+fatalError :: MonadIO m => String -> m a+fatalError msg = liftIO $ do syslog Error $ "Terminating from error: " ++ msg exitImmediately (ExitFailure 1)+ undefined -- You will never reach this; it's there to make the type checker happy++-- | Use this function when the daemon should terminate normally. It+-- logs a message, and exits with status 0.+exitCleanly :: MonadIO m => m a+exitCleanly = liftIO $ do+ syslog Notice "Exiting."+ exitImmediately ExitSuccess undefined -- You will never reach this; it's there to make the type checker happy
hdaemonize.cabal view
@@ -1,5 +1,5 @@ Name: hdaemonize-Version: 0.4.1+Version: 0.4.2 Cabal-Version: >= 1.6 License: BSD3 License-file: LICENSE@@ -17,7 +17,7 @@ Extra-Source-Files: README Library- Build-Depends: base >= 4 && < 5, unix, haskell98, hsyslog, extensible-exceptions, filepath+ Build-Depends: base >= 4 && < 5, unix, haskell98, hsyslog, extensible-exceptions, filepath, mtl Exposed-modules: System.Posix.Daemonize Ghc-Options: -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-name-shadowing