summaryrefslogtreecommitdiff
path: root/Command/WebApp.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-01 16:29:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-01 16:30:53 -0400
commit8181b38ef6060103953ce464d03e9cfd75c45663 (patch)
tree0ec9cc7219dd80590cff0cdfdac817b72728dc68 /Command/WebApp.hs
parentecc168aba30a0477381bcd2037c8d301368f3449 (diff)
write pid file even when running in foreground
This prevents multiple runs of the assistant in the foreground, and lets --stop stop foregrounded runs too. The webapp firstrun case also now writes a pid file, once it's made the git repo to put it in.
Diffstat (limited to 'Command/WebApp.hs')
-rw-r--r--Command/WebApp.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/Command/WebApp.hs b/Command/WebApp.hs
index 0ddf65c58..61de2c2f1 100644
--- a/Command/WebApp.hs
+++ b/Command/WebApp.hs
@@ -14,7 +14,7 @@ import Assistant.DaemonStatus
import Assistant.TransferQueue
import Assistant.Threads.WebApp
import Utility.WebApp
-import Utility.Daemon (checkDaemon)
+import Utility.Daemon (checkDaemon, lockPidFile)
import Init
import qualified Command.Watch
import qualified Git.CurrentRepo
@@ -94,6 +94,10 @@ firstRun = do
_wait <- takeMVar v
state <- Annex.new =<< Git.CurrentRepo.get
- Annex.eval state $
+ Annex.eval state $ do
+ dummydaemonize
startAssistant True id $ Just $ sendurlback v
sendurlback v url _htmlshim = putMVar v url
+ {- Set up the pid file in the new repo. -}
+ dummydaemonize = do
+ liftIO . lockPidFile =<< fromRepo gitAnnexPidFile