-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Do signal handling and orphan reaping for Unix PID1 init processes -- -- Please see README.md or view Haddocks at -- https://www.stackage.org/package/pid1 @package pid1 @version 0.1.2.0 module System.Process.PID1 -- | Holder for pid1 run options data RunOptions -- | return default RunOptions defaultRunOptions :: RunOptions -- | Get environment variable overrides for the given RunOptions getRunEnv :: RunOptions -> Maybe [(String, String)] -- | Return the timeout (in seconds) timeout (in seconds) to wait for all -- child processes to exit after receiving SIGTERM or SIGINT signal getRunExitTimeoutSec :: RunOptions -> Int -- | Get the process setGroupID group for the given -- RunOptions getRunGroup :: RunOptions -> Maybe String -- | Get the process setUserID user for the given RunOptions getRunUser :: RunOptions -> Maybe String -- | Get the process current directory for the given RunOptions getRunWorkDir :: RunOptions -> Maybe FilePath -- | Run the given command with specified arguments, with optional -- environment variable override (default is to use the current process's -- environment). -- -- This function will check if the current process has a process ID of 1. -- If it does, it will install signal handlers for SIGTERM and SIGINT, -- set up a loop to reap all orphans, spawn a child process, and when -- that child dies, kill all other processes (first with a SIGTERM and -- then a SIGKILL) and exit with the child's exit code. -- -- If this process is not PID1, then it will simply exec the -- given command. -- -- This function will never exit: it will always terminate your process, -- unless some exception is thrown. run :: FilePath -> [String] -> Maybe [(String, String)] -> IO a -- | Variant of run that runs a command, with optional environment -- posix user/group and working directory (default is to use the current -- process's user, group, environment, and current directory). runWithOptions :: RunOptions -> FilePath -> [String] -> IO a -- | Set environment variable overrides for the given RunOptions setRunEnv :: [(String, String)] -> RunOptions -> RunOptions -- | Set the timeout in seconds for the process reaper to wait for all -- child processes to exit after receiving SIGTERM or SIGINT signal setRunExitTimeoutSec :: Int -> RunOptions -> RunOptions -- | Set the process setGroupID group for the given -- RunOptions setRunGroup :: String -> RunOptions -> RunOptions -- | Set the process setUserID user for the given RunOptions setRunUser :: String -> RunOptions -> RunOptions -- | Set the process current directory for the given RunOptions setRunWorkDir :: FilePath -> RunOptions -> RunOptions instance GHC.Show.Show System.Process.PID1.RunOptions