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.
This commit is contained in:
parent
ecc168aba3
commit
8181b38ef6
3 changed files with 15 additions and 10 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue