-- 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.0.1
module System.Process.PID1
-- | 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