summaryrefslogtreecommitdiff
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-07-31 16:00:13 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-07-31 16:01:54 -0400
commitdbe6b403da47172346b2536b50a379e6d9b76e31 (patch)
tree2e1db476752b4431578d61c57e1851cd5def2629 /CmdLine.hs
parent9a01e2699598ab7affd7c19058bb2a6dad6d3a16 (diff)
Improve shutdown due to --time-limit, especially for fsck
* Perform a clean shutdown when --time-limit is reached. This includes running queued git commands, and cleanup actions normally run when a command is finished. * fsck: Commit incremental fsck database when --time-limit is reached. Previously, some of the last files fscked did not make it into the database when using --time-limit. Note that this changes Annex.addCleanup hooks, to run after --time-limit expires. Fsck was using such a hook to clean up after a --incremental-schedule, and that shouldn't run when --time-limit exipires it. So, instead, moved that cleanup code to be run by cleanupIncremental. Resulted in some data type juggling.
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs25
1 files changed, 1 insertions, 24 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 492a3b75f..a512d868d 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -5,29 +5,22 @@
- Licensed under the GNU GPL version 3 or higher.
-}
-{-# LANGUAGE CPP #-}
-
module CmdLine (
dispatch,
usage,
- shutdown
) where
import qualified Options.Applicative as O
import qualified Options.Applicative.Help as H
import qualified Control.Exception as E
-import qualified Data.Map as M
import Control.Exception (throw)
-#ifndef mingw32_HOST_OS
-import System.Posix.Signals
-#endif
import Common.Annex
import qualified Annex
import qualified Git
import qualified Git.AutoCorrect
import qualified Git.Config
-import Annex.Content
+import Annex.Action
import Annex.Environment
import Command
import Types.Messages
@@ -117,19 +110,3 @@ findCmd fuzzyok argv cmds
inexactcmds = case name of
Nothing -> []
Just n -> Git.AutoCorrect.fuzzymatches n cmdname cmds
-
-{- Actions to perform each time ran. -}
-startup :: Annex ()
-startup =
-#ifndef mingw32_HOST_OS
- liftIO $ void $ installHandler sigINT Default Nothing
-#else
- return ()
-#endif
-
-{- Cleanup actions. -}
-shutdown :: Bool -> Annex ()
-shutdown nocommit = do
- saveState nocommit
- sequence_ =<< M.elems <$> Annex.getState Annex.cleanup
- liftIO reapZombies -- zombies from long-running git processes