propellor spin

This commit is contained in:
Joey Hess 2014-04-04 18:34:03 -04:00
parent 6f9b3b2d8a
commit 0636846848
Failed to extract signature
1 changed files with 2 additions and 2 deletions

View File

@ -85,9 +85,9 @@ onlyProcess :: IO a -> IO a
onlyProcess a = bracket lock unlock (const a) onlyProcess a = bracket lock unlock (const a)
where where
lock = do lock = do
l <- openFd lockfile ReadWrite Nothing defaultFileFlags l <- createFile lockfile stdFileMode
setLock l (WriteLock, AbsoluteSeek, 0, 0) setLock l (WriteLock, AbsoluteSeek, 0, 0)
`catchIO` (const alreadyrunning) `catchIO` const alreadyrunning
return l return l
unlock = closeFd unlock = closeFd
alreadyrunning = error "Propellor is already running on this host!" alreadyrunning = error "Propellor is already running on this host!"