diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-11-13 15:51:45 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-11-13 15:51:45 -0400 |
commit | c006d97f0cb4a5b4f19d9faca9205a5081d54c67 (patch) | |
tree | 6ea6eca7d2748a98d7d2e1ac63ce49c9c80207c0 /Utility/LockFile | |
parent | 2f9fcff61101e0e696aa30ab79e0594b2ac32a0f (diff) |
one more try to get sane behavior our of lustre
Diffstat (limited to 'Utility/LockFile')
-rw-r--r-- | Utility/LockFile/PidLock.hs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Utility/LockFile/PidLock.hs b/Utility/LockFile/PidLock.hs index 68d9b7bac..5c5a89cc7 100644 --- a/Utility/LockFile/PidLock.hs +++ b/Utility/LockFile/PidLock.hs @@ -144,8 +144,11 @@ tryLock lockfile = trySideLock lockfile $ \sidelock -> do linkToLock :: SideLockHandle -> FilePath -> FilePath -> IO Bool linkToLock Nothing _ _ = return False linkToLock (Just _) src dest = do + -- This might make Lustre notice that a lock file that is already + -- there is there? + _ <- catchMaybeIO $ readFile dest _ <- tryIO $ createLink src dest - ifM (catchBoolIO checklink) + ifM (catchBoolIO checklinked) ( catchBoolIO $ do srccontent <- readFile src destcontent <- readFile dest @@ -153,7 +156,7 @@ linkToLock (Just _) src dest = do , return False ) where - checklink = do + checklinked = do x <- getSymbolicLinkStatus src y <- getSymbolicLinkStatus dest return $ and |