git annex webapp --force forces a restart of the daemon

Useful for testing..
This commit is contained in:
Joey Hess 2012-07-26 11:52:49 -04:00
parent c4830aaa6c
commit cccdb44874
3 changed files with 13 additions and 6 deletions

View file

@ -11,7 +11,7 @@ import Common.Annex
import Command
import Assistant
import Utility.WebApp
import Utility.Daemon
import Utility.Daemon (checkDaemon)
import qualified Annex
import Control.Concurrent
@ -25,9 +25,17 @@ seek = [withNothing start]
start :: CommandStart
start = notBareRepo $ do
r <- checkpid
when (r == Nothing) $
startassistant
ifM (Annex.getState Annex.force)
( do
stopDaemon
liftIO . catchMaybeIO . removeFile
=<< fromRepo gitAnnexPidFile
startassistant
, do
r <- checkpid
when (r == Nothing) $
startassistant
)
f <- liftIO . absPath =<< fromRepo gitAnnexHtmlShim
let url = "file://" ++ f
ifM (liftIO $ runBrowser url)

View file

@ -84,7 +84,7 @@ checkDaemon pidfile = do
| otherwise = error $
"stale pid in " ++ pidfile ++
" (got " ++ show pid' ++
"; expected" ++ show pid ++ " )"
"; expected " ++ show pid ++ " )"
{- Stops the daemon, safely. -}
stopDaemon :: FilePath -> IO ()

View file

@ -25,7 +25,6 @@ import Control.Exception
import Crypto.Random
import Data.Digest.Pure.SHA
import qualified Data.ByteString.Lazy as L
import Data.List
import qualified Data.Text as T
import qualified Data.Text.Encoding as TE
import Blaze.ByteString.Builder.Char.Utf8 (fromText)