diff options
-rw-r--r-- | Command/WebApp.hs | 16 | ||||
-rw-r--r-- | Utility/Daemon.hs | 2 | ||||
-rw-r--r-- | Utility/WebApp.hs | 1 |
3 files changed, 13 insertions, 6 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs index 0e01a07cd..e94338a2f 100644 --- a/Command/WebApp.hs +++ b/Command/WebApp.hs @@ -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) diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs index 8aa70d155..3386ea443 100644 --- a/Utility/Daemon.hs +++ b/Utility/Daemon.hs @@ -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 () diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs index 6936c6699..8a1887678 100644 --- a/Utility/WebApp.hs +++ b/Utility/WebApp.hs @@ -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) |