diff options
author | Joey Hess <joey@kitenet.net> | 2012-06-16 02:49:26 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-06-16 02:49:26 -0400 |
commit | 7d6329e5e4e4dd488b24e0002edcb2220073d8e9 (patch) | |
tree | 018d86db37b6c633773c2cd8b374cd1e1658085e /Assistant.hs | |
parent | 0052cec2b7e39652bd52cd4978ed47d2daa5af68 (diff) |
check lsof at runtime
Diffstat (limited to 'Assistant.hs')
-rw-r--r-- | Assistant.hs | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/Assistant.hs b/Assistant.hs index 4042c6ede..54556616d 100644 --- a/Assistant.hs +++ b/Assistant.hs @@ -52,7 +52,6 @@ import Assistant.SanityChecker import qualified Annex import qualified Utility.Daemon import Utility.LogFile -import qualified Build.SysConfig as SysConfig import Control.Concurrent @@ -66,11 +65,11 @@ startDaemon foreground pidfile <- fromRepo gitAnnexPidFile go $ Utility.Daemon.daemonize logfd (Just pidfile) False where - go a - | SysConfig.lsof = start a - | otherwise = - ifM (Annex.getState Annex.force) - (start a, needlsof) + go a = ifM (liftIO $ inPath "lsof") + ( go a + , ifM (Annex.getState Annex.force) + (start a, needlsof) + ) start a = withThreadState $ \st -> do dstatus <- startDaemonStatus liftIO $ a $ do @@ -85,16 +84,11 @@ startDaemon foreground _ <- forkIO $ sanityCheckerThread st dstatus changechan watchThread st dstatus changechan - -- this message is optimised away when lsof is available needlsof = error $ unlines - [ "The lsof command is needed for watch mode to be safe." - , "But this build of git-annex was made without lsof available. Giving up..." - , "" - , "You can use --force if lsof is available now. Please make very sure it is." - , "If run with --force and without lsof available, files can be added to the" - , "annex while a process still has them opened for writing. This can" - , "corrupt data in the annex, and make fsck complain." - , "Use the --force with caution, Luke!" + [ "The lsof command is needed for watch mode to be safe, and is not in PATH." + , "To override lsof checks to ensure that files are not open for writing" + , "when added to the annex, you can use --force" + , "Be warned: This can corrupt data in the annex, and make fsck complain." ] stopDaemon :: Annex () |