one more try to get sane behavior our of lustre
This commit is contained in:
parent
389c6c7d37
commit
70bfe218f5
1 changed files with 5 additions and 2 deletions
|
@ -144,8 +144,11 @@ tryLock lockfile = trySideLock lockfile $ \sidelock -> do
|
||||||
linkToLock :: SideLockHandle -> FilePath -> FilePath -> IO Bool
|
linkToLock :: SideLockHandle -> FilePath -> FilePath -> IO Bool
|
||||||
linkToLock Nothing _ _ = return False
|
linkToLock Nothing _ _ = return False
|
||||||
linkToLock (Just _) src dest = do
|
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
|
_ <- tryIO $ createLink src dest
|
||||||
ifM (catchBoolIO checklink)
|
ifM (catchBoolIO checklinked)
|
||||||
( catchBoolIO $ do
|
( catchBoolIO $ do
|
||||||
srccontent <- readFile src
|
srccontent <- readFile src
|
||||||
destcontent <- readFile dest
|
destcontent <- readFile dest
|
||||||
|
@ -153,7 +156,7 @@ linkToLock (Just _) src dest = do
|
||||||
, return False
|
, return False
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
checklink = do
|
checklinked = do
|
||||||
x <- getSymbolicLinkStatus src
|
x <- getSymbolicLinkStatus src
|
||||||
y <- getSymbolicLinkStatus dest
|
y <- getSymbolicLinkStatus dest
|
||||||
return $ and
|
return $ and
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue