git annex webapp --force forces a restart of the daemon
Useful for testing..
This commit is contained in:
parent
c4830aaa6c
commit
cccdb44874
3 changed files with 13 additions and 6 deletions
|
@ -11,7 +11,7 @@ import Common.Annex
|
||||||
import Command
|
import Command
|
||||||
import Assistant
|
import Assistant
|
||||||
import Utility.WebApp
|
import Utility.WebApp
|
||||||
import Utility.Daemon
|
import Utility.Daemon (checkDaemon)
|
||||||
import qualified Annex
|
import qualified Annex
|
||||||
|
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
@ -25,9 +25,17 @@ seek = [withNothing start]
|
||||||
|
|
||||||
start :: CommandStart
|
start :: CommandStart
|
||||||
start = notBareRepo $ do
|
start = notBareRepo $ do
|
||||||
r <- checkpid
|
ifM (Annex.getState Annex.force)
|
||||||
when (r == Nothing) $
|
( do
|
||||||
startassistant
|
stopDaemon
|
||||||
|
liftIO . catchMaybeIO . removeFile
|
||||||
|
=<< fromRepo gitAnnexPidFile
|
||||||
|
startassistant
|
||||||
|
, do
|
||||||
|
r <- checkpid
|
||||||
|
when (r == Nothing) $
|
||||||
|
startassistant
|
||||||
|
)
|
||||||
f <- liftIO . absPath =<< fromRepo gitAnnexHtmlShim
|
f <- liftIO . absPath =<< fromRepo gitAnnexHtmlShim
|
||||||
let url = "file://" ++ f
|
let url = "file://" ++ f
|
||||||
ifM (liftIO $ runBrowser url)
|
ifM (liftIO $ runBrowser url)
|
||||||
|
|
|
@ -84,7 +84,7 @@ checkDaemon pidfile = do
|
||||||
| otherwise = error $
|
| otherwise = error $
|
||||||
"stale pid in " ++ pidfile ++
|
"stale pid in " ++ pidfile ++
|
||||||
" (got " ++ show pid' ++
|
" (got " ++ show pid' ++
|
||||||
"; expected" ++ show pid ++ " )"
|
"; expected " ++ show pid ++ " )"
|
||||||
|
|
||||||
{- Stops the daemon, safely. -}
|
{- Stops the daemon, safely. -}
|
||||||
stopDaemon :: FilePath -> IO ()
|
stopDaemon :: FilePath -> IO ()
|
||||||
|
|
|
@ -25,7 +25,6 @@ import Control.Exception
|
||||||
import Crypto.Random
|
import Crypto.Random
|
||||||
import Data.Digest.Pure.SHA
|
import Data.Digest.Pure.SHA
|
||||||
import qualified Data.ByteString.Lazy as L
|
import qualified Data.ByteString.Lazy as L
|
||||||
import Data.List
|
|
||||||
import qualified Data.Text as T
|
import qualified Data.Text as T
|
||||||
import qualified Data.Text.Encoding as TE
|
import qualified Data.Text.Encoding as TE
|
||||||
import Blaze.ByteString.Builder.Char.Utf8 (fromText)
|
import Blaze.ByteString.Builder.Char.Utf8 (fromText)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue