aboutsummaryrefslogtreecommitdiff
path: root/Utility/Daemon.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-02-11 13:18:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-02-11 13:18:59 -0400
commitf779747a0d4d5c9e39a3c82498fe1809d56b4d25 (patch)
treecdcd646c01afed8e65f7ea5fd48fe92f0dd295bf /Utility/Daemon.hs
parentcbb6c57513753ca9e787bfeff1145c5c9d62aedd (diff)
remove unimplemented windows stubs
Diffstat (limited to 'Utility/Daemon.hs')
-rw-r--r--Utility/Daemon.hs8
1 files changed, 2 insertions, 6 deletions
diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs
index afba68535..1654821af 100644
--- a/Utility/Daemon.hs
+++ b/Utility/Daemon.hs
@@ -21,6 +21,7 @@ import Control.Concurrent.Async
import System.PosixCompat.Types
#endif
+#ifndef mingw32_HOST_OS
{- Run an action as a daemon, with all output sent to a file descriptor.
-
- Can write its pid to a file, to guard against multiple instances
@@ -28,7 +29,6 @@ import System.PosixCompat.Types
-
- When successful, does not return. -}
daemonize :: Fd -> Maybe FilePath -> Bool -> IO () -> IO ()
-#ifndef mingw32_HOST_OS
daemonize logfd pidfile changedirectory a = do
maybe noop checkalreadyrunning pidfile
_ <- forkProcess child1
@@ -52,8 +52,6 @@ daemonize logfd pidfile changedirectory a = do
wait =<< asyncWithUnmask (\unmask -> unmask a)
out
out = exitImmediately ExitSuccess
-#else
-daemonize = error "daemonize is not implemented on Windows" -- TODO
#endif
{- Locks the pid file, with an exclusive, non-blocking lock.
@@ -112,13 +110,11 @@ checkDaemon pidfile = do
checkDaemon pidfile = maybe Nothing readish <$> catchMaybeIO (readFile pidfile)
#endif
+#ifndef mingw32_HOST_OS
{- Stops the daemon, safely. -}
stopDaemon :: FilePath -> IO ()
-#ifndef mingw32_HOST_OS
stopDaemon pidfile = go =<< checkDaemon pidfile
where
go Nothing = noop
go (Just pid) = signalProcess sigTERM pid
-#else
-stopDaemon = error "stopDaemon is not implemented on Windows" -- TODO
#endif