Windows: Fix locking issue that prevented the webapp starting (since 5.20140707).
Reversion introduced in 9fb8038166
.
The locking code was wrong; the webapp re-ran itself, saw pid was locked,
and so didn't start!
This commit is contained in:
parent
2416ed18c4
commit
339a3b8ab0
3 changed files with 16 additions and 2 deletions
|
@ -102,7 +102,6 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
|
||||||
createAnnexDirectory (parentDir logfile)
|
createAnnexDirectory (parentDir logfile)
|
||||||
ifM (liftIO $ isNothing <$> getEnv flag)
|
ifM (liftIO $ isNothing <$> getEnv flag)
|
||||||
( liftIO $ withFile devNull WriteMode $ \nullh -> do
|
( liftIO $ withFile devNull WriteMode $ \nullh -> do
|
||||||
Utility.Daemon.lockPidFile pidfile
|
|
||||||
when (not foreground) $
|
when (not foreground) $
|
||||||
debugM desc $ "logging to " ++ logfile
|
debugM desc $ "logging to " ++ logfile
|
||||||
loghandle <- openLog logfile
|
loghandle <- openLog logfile
|
||||||
|
@ -116,7 +115,7 @@ startDaemon assistant foreground startdelay cannotrun listenhost startbrowser =
|
||||||
, std_err = UseHandle loghandle
|
, std_err = UseHandle loghandle
|
||||||
}
|
}
|
||||||
exitWith =<< waitForProcess pid
|
exitWith =<< waitForProcess pid
|
||||||
, start id $ do
|
, start (Utility.Daemon.foreground (Just pidfile)) $
|
||||||
case startbrowser of
|
case startbrowser of
|
||||||
Nothing -> Nothing
|
Nothing -> Nothing
|
||||||
Just a -> Just $ a Nothing Nothing
|
Just a -> Just $ a Nothing Nothing
|
||||||
|
|
|
@ -21,6 +21,8 @@ import Utility.WinLock
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
import System.Posix
|
import System.Posix
|
||||||
import Control.Concurrent.Async
|
import Control.Concurrent.Async
|
||||||
|
#else
|
||||||
|
import System.Exit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef mingw32_HOST_OS
|
#ifndef mingw32_HOST_OS
|
||||||
|
@ -54,15 +56,26 @@ daemonize logfd pidfile changedirectory a = do
|
||||||
wait =<< asyncWithUnmask (\unmask -> unmask a)
|
wait =<< asyncWithUnmask (\unmask -> unmask a)
|
||||||
out
|
out
|
||||||
out = exitImmediately ExitSuccess
|
out = exitImmediately ExitSuccess
|
||||||
|
#endif
|
||||||
|
|
||||||
{- To run an action that is normally daemonized in the forground. -}
|
{- To run an action that is normally daemonized in the forground. -}
|
||||||
|
#ifndef mingw32_HOST_OS
|
||||||
foreground :: Fd -> Maybe FilePath -> IO () -> IO ()
|
foreground :: Fd -> Maybe FilePath -> IO () -> IO ()
|
||||||
foreground logfd pidfile a = do
|
foreground logfd pidfile a = do
|
||||||
|
#else
|
||||||
|
foreground :: Maybe FilePath -> IO () -> IO ()
|
||||||
|
foreground pidfile a = do
|
||||||
|
#endif
|
||||||
maybe noop lockPidFile pidfile
|
maybe noop lockPidFile pidfile
|
||||||
|
#ifndef mingw32_HOST_OS
|
||||||
_ <- tryIO createSession
|
_ <- tryIO createSession
|
||||||
redirLog logfd
|
redirLog logfd
|
||||||
|
#endif
|
||||||
a
|
a
|
||||||
|
#ifndef mingw32_HOST_OS
|
||||||
exitImmediately ExitSuccess
|
exitImmediately ExitSuccess
|
||||||
|
#else
|
||||||
|
exitWith ExitSuccess
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{- Locks the pid file, with an exclusive, non-blocking lock,
|
{- Locks the pid file, with an exclusive, non-blocking lock,
|
||||||
|
|
2
debian/changelog
vendored
2
debian/changelog
vendored
|
@ -13,6 +13,8 @@ git-annex (5.20140710) UNRELEASED; urgency=medium
|
||||||
resolver.
|
resolver.
|
||||||
* Deal with change in git 2.0 that made indirect mode merge conflict
|
* Deal with change in git 2.0 that made indirect mode merge conflict
|
||||||
resolution leave behind old files.
|
resolution leave behind old files.
|
||||||
|
* Windows: Fix locking issue that prevented the webapp starting
|
||||||
|
(since 5.20140707).
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Wed, 09 Jul 2014 23:29:21 -0400
|
-- Joey Hess <joeyh@debian.org> Wed, 09 Jul 2014 23:29:21 -0400
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue