diff options
Diffstat (limited to 'Command/RemoteDaemon.hs')
-rw-r--r-- | Command/RemoteDaemon.hs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/Command/RemoteDaemon.hs b/Command/RemoteDaemon.hs index 7c7ecef4b..c68cf816a 100644 --- a/Command/RemoteDaemon.hs +++ b/Command/RemoteDaemon.hs @@ -1,25 +1,32 @@ {- git-annex command - - - Copyright 2014 Joey Hess <id@joeyh.name> + - Copyright 2014-2016 Joey Hess <id@joeyh.name> - - Licensed under the GNU GPL version 3 or higher. -} +{-# LANGUAGE CPP #-} + module Command.RemoteDaemon where import Command import RemoteDaemon.Core +import Utility.Daemon cmd :: Command -cmd = noCommit $ - command "remotedaemon" SectionPlumbing - "detects when remotes have changed, and fetches from them" - paramNothing (withParams seek) - -seek :: CmdParams -> CommandSeek -seek = withNothing start +cmd = noCommit $ dontCheck repoExists $ + command "remotedaemon" SectionMaintenance + "persistent communication with remotes" + paramNothing (run <$$> const parseDaemonOptions) -start :: CommandStart -start = do - liftIO runForeground - stop +run :: DaemonOptions -> CommandSeek +run o + | stopDaemonOption o = error "--stop not implemented for remotedaemon" + | foregroundDaemonOption o = liftIO runInteractive + | otherwise = do +#ifndef mingw32_HOST_OS + nullfd <- liftIO $ openFd "/dev/null" ReadOnly Nothing defaultFileFlags + liftIO $ daemonize nullfd Nothing False runNonInteractive +#else + liftIO $ foreground Nothing runNonInteractive +#endif |