-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Run an IO action protected by a pidfile
--
-- Run an IO action protected by a pidfile. This will prevent more than
-- one instance of your program to run at a time.
@package pidfile
@version 0.1.0.4
-- | Run an IO action protected by a pidfile. This will prevent more than
-- one instance of your program to run at a time.
module System.PidFile
-- | withPidFile path act creates a pidfile at the
-- specified path containing the Process ID of the current
-- process. Then act is run, the pidfile is removed and the
-- result of act returned wrapped in a Just.
--
-- If the pidfile already exists, act is not run, and
-- Nothing is returned. Any other error while creating the pidfile
-- results in an error.
--
-- If an exception is raised in act, the pidfile is removed
-- before the exception is propagated.
--
-- The pidfile is created with O_CREAT and O_EXCL flags
-- to ensure that an already existing pidfile is never accidentally
-- overwitten.
withPidFile :: FilePath -> IO a -> IO (Maybe a)