propellor spin
This commit is contained in:
parent
6f9b3b2d8a
commit
0636846848
|
@ -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!"
|
||||||
|
|
Loading…
Reference in New Issue