From ca09087caf5298b01f05bae4a4601fce47966c4f Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sat, 22 Nov 2014 22:24:09 -0400 Subject: propellor spin --- src/Propellor/Engine.hs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Propellor/Engine.hs') diff --git a/src/Propellor/Engine.hs b/src/Propellor/Engine.hs index b551ca05..0b65fb7e 100644 --- a/src/Propellor/Engine.hs +++ b/src/Propellor/Engine.hs @@ -11,6 +11,8 @@ import "mtl" Control.Monad.Reader import Control.Exception (bracket) import System.PosixCompat import System.Posix.IO +import System.FilePath +import System.Directory import Propellor.Types import Propellor.Message @@ -60,6 +62,7 @@ onlyProcess :: FilePath -> IO a -> IO a onlyProcess lockfile a = bracket lock unlock (const a) where lock = do + createDirectoryIfMissing True (takeDirectory lockfile) l <- createFile lockfile stdFileMode setLock l (WriteLock, AbsoluteSeek, 0, 0) `catchIO` const alreadyrunning -- cgit v1.3-2-g0d8e