-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Monad transformer for exit codes -- -- -- Monad transformer for exit codes @package exitcode @version 0.1.0.8 module Control.Exitcode -- | An exit code status where failing with a value `0` cannot be -- represented. -- -- Transformer for either a (non-zero exit code value (Int) with -- error :: e) or a (value :: a). data ExitcodeT f e a type Exitcode e a = ExitcodeT Identity e a type ExitcodeT0 f = ExitcodeT f () () type Exitcode0 = Exitcode () () type ExitcodeT1 f a = ExitcodeT f a a type Exitcode1 a = ExitcodeT1 Identity a -- | Construct a succeeding exit code with the given value. -- --
-- >>> exitsuccess "abc" :: ExitcodeT Identity () String -- ExitcodeT (Identity (Right "abc")) --exitsuccess :: Applicative f => a -> ExitcodeT f e a -- | Construct a succeeding exit code with unit. -- --
-- >>> exitsuccess0 :: ExitcodeT0 Identity -- ExitcodeT (Identity (Right ())) --exitsuccess0 :: Applicative f => ExitcodeT f e () -- | Construct a failing exit code with the given status. -- -- If the given status is `0` then the exit code will succeed with unit. -- --
-- >>> exitfailure 'x' 99 :: ExitcodeT Identity Char ()
-- ExitcodeT (Identity (Left ('x',99)))
--
exitfailure :: Applicative f => e -> Int -> ExitcodeT f e ()
-- | Construct a failing exit code with the given status.
--
-- If the given status is `0` then the exit code will succeed with unit.
exitfailure0 :: Applicative f => Int -> ExitcodeT0 f
-- | Construct an exit code with the given status. Associate a value of
-- type e with a failing exit code and a value of the type
-- a with a success exit code.
--
-- If the given status is `0` then the exit code will succeed with unit.
-- >>> exitcodeValue x 99 "abc" :: ExitcodeT Identity
-- Char String ExitcodeT (Identity (Left (x,99))) >>>
-- exitcodeValue x 0 "abc" :: ExitcodeT Identity Char String
-- ExitcodeT (Identity (Right "abc"))
exitcodeValue :: Applicative f => e -> Int -> a -> ExitcodeT f e a
-- | Construct an exit code with the given status.
--
-- If the given status is `0` then the exit code will succeed with unit.
--
-- -- >>> exitcodeValue0 99 :: ExitcodeT0 Identity -- ExitcodeT (Identity (Left ((),99))) -- -- >>> exitcodeValue0 0 :: ExitcodeT0 Identity -- ExitcodeT (Identity (Right ())) --exitcodeValue0 :: Applicative f => Int -> ExitcodeT0 f -- | From base exitcode. -- --
-- >>> fromExitCode (Identity ExitSuccess) -- ExitcodeT (Identity (Right ())) -- -- >>> fromExitCode (Identity (ExitFailure 99)) -- ExitcodeT (Identity (Left ((),99))) --fromExitCode :: Functor f => f ExitCode -> ExitcodeT0 f -- | From base exitcode. -- --
-- >>> fromExitCode' ExitSuccess -- ExitcodeT (Identity (Right ())) -- -- >>> fromExitCode' (ExitFailure 99) -- ExitcodeT (Identity (Left ((),99))) -- -- >>> fromExitCode' (ExitFailure 0) -- ExitcodeT (Identity (Right ())) --fromExitCode' :: ExitCode -> Exitcode0 liftExitcode :: Functor f => f a -> ExitcodeT f e a liftExitcodeError :: Functor f => f (e, Int) -> a -> ExitcodeT f e a liftExitcodeError0 :: Functor f => f Int -> ExitcodeT f () () hoistExitcode :: (forall x. f x -> g x) -> ExitcodeT f e a -> ExitcodeT g e a embedExitcode :: Functor g => (forall x. f x -> ExitcodeT g e x) -> ExitcodeT f e a -> ExitcodeT g e a -- | Construct an exitcode with an associated value. -- --
-- >>> exitcode1 99 "abc" :: ExitcodeT1 Identity String
-- ExitcodeT (Identity (Left ("abc",99)))
--
-- >>> exitcode1 0 "abc" :: ExitcodeT1 Identity String
-- ExitcodeT (Identity (Right "abc"))
--
exitcode1 :: Applicative f => Int -> a -> ExitcodeT1 f a
-- | Extract either the non-zero value or the success value.
--
-- -- >>> runExitcodeT exitsuccess0 :: Identity (Either ((), Int) ()) -- Identity (Right ()) -- -- >>> runExitcodeT (exitfailure () 99) :: Identity (Either ((), Int) ()) -- Identity (Left ((),99)) --runExitcodeT :: ExitcodeT f e a -> f (Either (e, Int) a) -- | Extract either the non-zero value or Nothing. -- --
-- >>> runExitcodeT0 exitsuccess0 :: Identity (Maybe Int) -- Identity Nothing -- -- >>> runExitcodeT0 (exitfailure () 99) :: Identity (Maybe Int) -- Identity (Just 99) --runExitcodeT0 :: Functor f => ExitcodeT0 f -> f (Maybe Int) -- | Extract either the non-zero value or the success value. -- --
-- >>> runExitcode exitsuccess0 :: Either ((), Int) () -- Right () -- -- >>> runExitcode (exitfailure () 99) :: Either ((), Int) () -- Left ((),99) --runExitcode :: Exitcode e a -> Either (e, Int) a -- | Extract either the non-zero value or Nothing. -- --
-- >>> runExitcode0 exitsuccess0 :: Maybe Int -- Nothing -- -- >>> runExitcode0 (exitfailure () 99) :: Maybe Int -- Just 99 --runExitcode0 :: Exitcode0 -> Maybe Int -- | Extract either the non-zero value or the success value. -- --
-- >>> runExitcodeT1 exitsuccess0
-- Right ()
--
-- >>> runExitcodeT1 (exitfailure () 99) :: Identity (Either ((), Int) ())
-- Identity (Left ((),99))
--
-- >>> runExitcodeT1 (exitcode1 0 "abc") :: Identity (Either (String, Int) String)
-- Identity (Right "abc")
--
-- >>> runExitcodeT1 (exitcode1 99 "abc") :: Identity (Either (String, Int) String)
-- Identity (Left ("abc",99))
--
runExitcodeT1 :: ExitcodeT1 f a -> f (Either (a, Int) a)
-- | Extract either the non-zero value or the success value.
--
--
-- >>> runExitcode1 exitsuccess0
-- Right ()
--
-- >>> runExitcode1 (exitfailure () 99)
-- Left ((),99)
--
-- >>> runExitcode1 (exitcode1 0 "abc")
-- Right "abc"
--
-- >>> runExitcode1 (exitcode1 99 "abc")
-- Left ("abc",99)
--
runExitcode1 :: Exitcode1 a -> Either (a, Int) a
tryExitcode :: Exception e' => ExitcodeT IO e a -> ExitcodeT (ExceptT e' IO) e (Either e' a)
-- | Isomorphism from base exitcode to underlying `Maybe (Either Int ())`
-- where Int is non-zero.
--
-- -- >>> view exitCode (Identity (ExitFailure 99)) -- ExitcodeT (MaybeT (Identity (Just (Left ((),99))))) -- -- >>> view exitCode (Identity ExitSuccess) -- ExitcodeT (MaybeT (Identity (Just (Right ())))) -- -- >>> Control.Lens.review exitCode (exitfailure () 99) :: Identity ExitCode -- Identity (ExitFailure 99) -- -- >>> Control.Lens.review exitCode exitsuccess0 :: Identity ExitCode -- Identity ExitSuccess --exitCode :: (Functor f, Functor g) => Iso (f ExitCode) (g ExitCode) (ExitcodeT0 (MaybeT f)) (ExitcodeT0 (MaybeT g)) -- | Isomorphism to integer. -- --
-- >>> view _ExitcodeInt exitsuccess0 :: [Int] -- [0] -- -- >>> view _ExitcodeInt (exitfailure0 99) :: [Int] -- [99] -- -- >>> review _ExitcodeInt [0] -- ExitcodeT [Right ()] -- -- >>> review _ExitcodeInt [99] -- ExitcodeT [Left ((),99)] --_ExitcodeInt :: (Functor f, Functor f') => Iso (ExitcodeT0 f) (ExitcodeT0 f') (f Int) (f' Int) -- | Setter to integer. -- --
-- >>> > preview _ExitcodeInt' (exitsuccess0 :: ExitcodeT [] () ()) -- Just 0 -- -- >>> preview _ExitcodeInt' (exitfailure0 99 :: ExitcodeT [] () ()) -- Just 99 -- -- >>> preview _ExitcodeInt' (exitfailure0 0 :: ExitcodeT [] () ()) -- Just 0 -- -- >>> over _ExitcodeInt' (subtract 1) exitsuccess0 :: ExitcodeT0 Identity -- ExitcodeT (Identity (Left ((),-1))) -- -- >>> over _ExitcodeInt' (subtract 1) (exitfailure0 99) :: ExitcodeT0 Identity -- ExitcodeT (Identity (Left ((),98))) -- -- >>> over _ExitcodeInt' (subtract 1) (exitfailure0 1) :: ExitcodeT0 Identity -- ExitcodeT (Identity (Right ())) --_ExitcodeInt' :: Traversable f => Traversal' (ExitcodeT0 f) Int -- | A traversal to exit failure. -- --
-- >>> preview _ExitFailure (exitfailure () 99 :: ExitcodeT0 Identity)
-- Just ((),99)
--
-- >>> preview _ExitFailure (exitsuccess0 :: ExitcodeT0 Identity)
-- Nothing
--
-- >>> over _ExitFailure (\(e, n) -> (e + 1, n + 1)) (exitsuccess0 :: ExitcodeT Identity Int ())
-- ExitcodeT (Identity (Right ()))
--
-- >>> over _ExitFailure (\(e, n) -> (reverse e, n + 1)) (exitfailure "abc" 1 :: ExitcodeT Identity String ())
-- ExitcodeT (Identity (Left ("cba",2)))
--
-- >>> over _ExitFailure (\(e, n) -> (reverse e, n - 1)) (exitfailure "abc" 1 :: ExitcodeT Identity String ())
-- ExitcodeT (Identity (Right ()))
--
_ExitFailure :: Traversable f => Traversal (ExitcodeT f e ()) (ExitcodeT f e' ()) (e, Int) (e', Int)
-- | A traversal over the associated failing value.
--
--
-- >>> over _ExitFailureError reverse exitsuccess0 :: ExitcodeT Identity [Int] ()
-- ExitcodeT (Identity (Right ()))
--
-- >>> over _ExitFailureError reverse (exitfailure "abc" 99) :: ExitcodeT Identity String ()
-- ExitcodeT (Identity (Left ("cba",99)))
--
-- >>> over _ExitFailureError reverse (exitfailure "abc" 0) :: ExitcodeT Identity String ()
-- ExitcodeT (Identity (Right ()))
--
-- >>> preview _ExitFailureError (exitfailure () 99 :: ExitcodeT0 Identity)
-- Just ()
--
-- >>> preview _ExitFailureError (exitsuccess0 :: ExitcodeT0 Identity)
-- Nothing
--
_ExitFailureError :: Traversable f => Traversal (ExitcodeT f e a) (ExitcodeT f e' a) e e'
-- | A prism to exit success.
--
-- -- >>> over _ExitSuccess (\x -> x) (exitfailure0 99) -- ExitcodeT (Identity (Left ((),99))) -- -- >>> over _ExitSuccess (\x -> x) (exitfailure0 0) -- ExitcodeT (Identity (Right ())) -- -- >>> over _ExitSuccess (\x -> x) (exitfailure0 0) -- ExitcodeT (Identity (Right ())) -- -- >>> preview _ExitSuccess (exitfailure () 99) -- Nothing -- -- >>> preview _ExitSuccess exitsuccess0 -- Just () -- -- >>> Control.Lens.review _ExitSuccess "abc" :: ExitcodeT Identity () String -- ExitcodeT (Identity (Right "abc")) --_ExitSuccess :: Prism (Exitcode e a) (Exitcode e a') a a' -- | A lens to the value associated with an exitcode. -- --
-- >>> view _Exitcode1 (exitcode1 0 "abc")
-- "abc"
--
-- >>> view _Exitcode1 (exitcode1 99 "abc")
-- "abc"
--
-- >>> view _Exitcode1 (exitcodeValue "abc" 0 "def")
-- "def"
--
-- >>> view _Exitcode1 (exitcodeValue "abc" 99 "def")
-- "abc"
--
-- >>> over _Exitcode1 reverse (exitcode1 0 "abc")
-- ExitcodeT (Identity (Right "cba"))
--
-- >>> over _Exitcode1 reverse (exitcode1 99 "abc")
-- ExitcodeT (Identity (Left ("cba",99)))
--
-- >>> over _Exitcode1 reverse (exitcodeValue "abc" 0 "def")
-- ExitcodeT (Identity (Right "fed"))
--
-- >>> over _Exitcode1 reverse (exitcodeValue "abc" 99 "def")
-- ExitcodeT (Identity (Left ("cba",99)))
--
_Exitcode1 :: Lens (Exitcode1 a) (Exitcode1 a') a a'
instance GHC.Base.Functor f => GHC.Base.Functor (Control.Exitcode.ExitcodeT f e)
instance GHC.Base.Monad f => Data.Functor.Bind.Class.Apply (Control.Exitcode.ExitcodeT f e)
instance GHC.Base.Monad f => GHC.Base.Applicative (Control.Exitcode.ExitcodeT f e)
instance GHC.Base.Monad f => Data.Functor.Bind.Class.Bind (Control.Exitcode.ExitcodeT f e)
instance GHC.Base.Monad f => GHC.Base.Monad (Control.Exitcode.ExitcodeT f e)
instance GHC.Base.Monad f => Data.Functor.Alt.Alt (Control.Exitcode.ExitcodeT f e)
instance (GHC.Base.Semigroup a, GHC.Base.Applicative f) => GHC.Base.Semigroup (Control.Exitcode.ExitcodeT f e a)
instance (GHC.Base.Monoid a, GHC.Base.Applicative f) => GHC.Base.Monoid (Control.Exitcode.ExitcodeT f e a)
instance Data.Functor.Extend.Extend f => Data.Functor.Extend.Extend (Control.Exitcode.ExitcodeT f e)
instance (Data.Functor.Classes.Eq1 f, GHC.Classes.Eq e, GHC.Classes.Eq a) => GHC.Classes.Eq (Control.Exitcode.ExitcodeT f e a)
instance (Data.Functor.Classes.Eq1 f, GHC.Classes.Eq e) => Data.Functor.Classes.Eq1 (Control.Exitcode.ExitcodeT f e)
instance (Data.Functor.Classes.Ord1 f, GHC.Classes.Ord e, GHC.Classes.Ord a) => GHC.Classes.Ord (Control.Exitcode.ExitcodeT f e a)
instance (Data.Functor.Classes.Ord1 f, GHC.Classes.Ord e) => Data.Functor.Classes.Ord1 (Control.Exitcode.ExitcodeT f e)
instance (Data.Functor.Classes.Show1 f, GHC.Show.Show e, GHC.Show.Show a) => GHC.Show.Show (Control.Exitcode.ExitcodeT f e a)
instance (Data.Functor.Classes.Show1 f, GHC.Show.Show e) => Data.Functor.Classes.Show1 (Control.Exitcode.ExitcodeT f e)
instance Data.Foldable.Foldable f => Data.Foldable.Foldable (Control.Exitcode.ExitcodeT f e)
instance Data.Traversable.Traversable f => Data.Traversable.Traversable (Control.Exitcode.ExitcodeT f e)
instance Control.Monad.IO.Class.MonadIO f => Control.Monad.IO.Class.MonadIO (Control.Exitcode.ExitcodeT f e)
instance Control.Monad.Reader.Class.MonadReader r f => Control.Monad.Reader.Class.MonadReader r (Control.Exitcode.ExitcodeT f e)
instance Control.Monad.Writer.Class.MonadWriter w f => Control.Monad.Writer.Class.MonadWriter w (Control.Exitcode.ExitcodeT f e)
instance Control.Monad.State.Class.MonadState s f => Control.Monad.State.Class.MonadState s (Control.Exitcode.ExitcodeT f e)
instance Control.Monad.Error.Class.MonadError e f => Control.Monad.Error.Class.MonadError e (Control.Exitcode.ExitcodeT f e')
instance Control.Monad.RWS.Class.MonadRWS r w s f => Control.Monad.RWS.Class.MonadRWS r w s (Control.Exitcode.ExitcodeT f e)
instance Control.Monad.Cont.Class.MonadCont f => Control.Monad.Cont.Class.MonadCont (Control.Exitcode.ExitcodeT f e)
instance GHC.Base.Functor f => Data.Bifunctor.Bifunctor (Control.Exitcode.ExitcodeT f)
instance Data.Foldable.Foldable f => Data.Bifoldable.Bifoldable (Control.Exitcode.ExitcodeT f)
instance Data.Traversable.Traversable f => Data.Bitraversable.Bitraversable (Control.Exitcode.ExitcodeT f)
module Control.Process.CmdSpec
class AsCmdSpec a
_CmdSpec :: AsCmdSpec a => Prism' a CmdSpec
_ShellCommand :: AsCmdSpec a => Prism' a String
_RawCommand :: AsCmdSpec a => Prism' a (FilePath, [String])
_RawCommandExe :: AsCmdSpec a => Traversal' a FilePath
_RawCommandArgumentList :: AsCmdSpec a => Traversal' a [String]
_RawCommandArguments :: AsCmdSpec a => Traversal' a String
class HasCmdSpec a
cmdSpec :: HasCmdSpec a => Lens' a CmdSpec
shellCommand :: HasCmdSpec a => Traversal' a String
rawCommand :: HasCmdSpec a => Traversal' a (FilePath, [String])
rawCommandExe :: HasCmdSpec a => Traversal' a FilePath
rawCommandArgumentList :: HasCmdSpec a => Traversal' a [String]
rawCommandArguments :: HasCmdSpec a => Traversal' a String
instance Control.Process.CmdSpec.HasCmdSpec System.Process.Common.CmdSpec
instance Control.Process.CmdSpec.HasCmdSpec System.Process.Common.CreateProcess
instance Control.Process.CmdSpec.AsCmdSpec System.Process.Common.CmdSpec
module Control.Process.FD
class HasFD a
fd :: HasFD a => Lens' a FD
fdInt32 :: HasFD a => Lens' a Int32
class AsFD a
_FD :: AsFD a => Prism' a FD
_FDInt32 :: AsFD a => Prism' a Int32
instance Control.Process.FD.AsFD System.Posix.Internals.FD
instance Control.Process.FD.HasFD System.Posix.Internals.FD
module Control.Process.GroupID
class HasGroupID a
groupID :: HasGroupID a => Lens' a GroupID
class AsGroupID a
_GroupID :: AsGroupID a => Prism' a GroupID
instance Control.Process.GroupID.AsGroupID System.Posix.Types.GroupID
instance Control.Process.GroupID.HasGroupID System.Posix.Types.GroupID
module Control.Process.Handle
class HasHandle a
handle :: HasHandle a => Lens' a Handle
class AsHandle a
_Handle :: AsHandle a => Prism' a Handle
instance Control.Process.Handle.AsHandle GHC.IO.Handle.Types.Handle
instance Control.Process.Handle.AsHandle System.Process.Common.StdStream
instance Control.Process.Handle.HasHandle GHC.IO.Handle.Types.Handle
module Control.Process.Pid
class HasPid a
pid :: HasPid a => Lens' a Pid
pidInt32 :: HasPid a => Lens' a Int32
class AsPid a
_Pid :: AsPid a => Prism' a Pid
_PidInt32 :: AsPid a => Prism' a Int32
instance Control.Process.Pid.AsPid System.Process.Pid
instance Control.Process.Pid.HasPid System.Process.Pid
module Control.Process.Process
-- | The platform specific type for a process identifier.
--
-- This is always an integral type. Width and signedness are platform
-- specific.
type Pid = CPid
-- | A bracket-style resource handler for createProcess.
--
-- Does automatic cleanup when the action finishes. If there is an
-- exception in the body then it ensures that the process gets terminated
-- and any CreatePipe Handles are closed. In particular
-- this means that if the Haskell thread is killed (e.g.
-- killThread), that the external process is also terminated.
--
-- e.g.
--
--
-- withCreateProcess (proc cmd args) { ... } $ \stdin stdout stderr ph -> do
-- ...
--
withCreateProcess :: CreateProcess -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> IO a) -> IO a
-- | Attempts to terminate the specified process. This function should not
-- be used under normal circumstances - no guarantees are given regarding
-- how cleanly the process is terminated. To check whether the process
-- has indeed terminated, use getProcessExitCode.
--
-- On Unix systems, terminateProcess sends the process the SIGTERM
-- signal. On Windows systems, if use_process_jobs is True
-- then the Win32 TerminateJobObject function is called to kill
-- all processes associated with the job and passing the exit code of 1
-- to each of them. Otherwise if use_process_jobs is False
-- then the Win32 TerminateProcess function is called, passing
-- an exit code of 1.
--
-- Note: on Windows, if the process was a shell command created by
-- createProcess with shell, or created by
-- runCommand or runInteractiveCommand, then
-- terminateProcess will only terminate the shell, not the command
-- itself. On Unix systems, both processes are in a process group and
-- will be terminated together.
terminateProcess :: ProcessHandle -> IO ()
-- | Creates a new process to run the specified raw command with the given
-- arguments. It does not wait for the program to finish, but returns the
-- ProcessHandle.
spawnProcess :: FilePath -> [String] -> IO ProcessHandle
-- | Given a program p and arguments args,
-- showCommandForUser p args returns a string
-- suitable for pasting into /bin/sh (on Unix systems) or
-- CMD.EXE (on Windows).
showCommandForUser :: FilePath -> [String] -> String
-- | Construct a CreateProcess record for passing to
-- createProcess, representing a command to be passed to the
-- shell.
shell :: String -> CreateProcess
-- | readProcess forks an external process, reads its standard
-- output strictly, blocking until the process terminates, and returns
-- the output string. The external process inherits the standard error.
--
-- If an asynchronous exception is thrown to the thread executing
-- readProcess, the forked process will be terminated and
-- readProcess will wait (block) until the process has been
-- terminated.
--
-- Output is returned strictly, so this is not suitable for launching
-- processes that require interaction over the standard file streams.
--
-- This function throws an IOError if the process ExitCode
-- is anything other than ExitSuccess. If instead you want to get
-- the ExitCode then use readProcessWithExitCode.
--
-- Users of this function should compile with -threaded if they
-- want other Haskell threads to keep running while waiting on the result
-- of readProcess.
--
-- -- > readProcess "date" [] [] -- "Thu Feb 7 10:03:39 PST 2008\n" ---- -- The arguments are: -- --
-- > readCreateProcess ((shell "pwd") { cwd = Just "/etc/" }) ""
-- "/etc\n"
--
--
-- Note that Handles provided for std_in or
-- std_out via the CreateProcess record will be ignored.
readCreateProcess :: CreateProcess -> String -> IO String
-- | Construct a CreateProcess record for passing to
-- createProcess, representing a raw command with arguments.
--
-- See RawCommand for precise semantics of the specified
-- FilePath.
proc :: FilePath -> [String] -> CreateProcess
-- | Returns the PID (process ID) of a subprocess.
--
-- Nothing is returned if the handle was already closed. Otherwise
-- a PID is returned that remains valid as long as the handle is open.
-- The operating system may reuse the PID as soon as the last handle to
-- the process is closed.
getPid :: ProcessHandle -> IO (Maybe Pid)
-- | Returns the PID (process ID) of the current process. On POSIX systems,
-- this calls getProcessID from System.Posix.Process in the
-- unix package. On Windows, this calls
-- getCurrentProcessId from System.Win32.Process in the
-- Win32 package.
getCurrentPid :: IO Pid
-- | This is the most general way to spawn an external process. The process
-- can be a command line to be executed by a shell or a raw command with
-- a list of arguments. The stdin, stdout, and stderr streams of the new
-- process may individually be attached to new pipes, to existing
-- Handles, or just inherited from the parent (the default.)
--
-- The details of how to create the process are passed in the
-- CreateProcess record. To make it easier to construct a
-- CreateProcess, the functions proc and shell are
-- supplied that fill in the fields with default values which can be
-- overriden as needed.
--
-- createProcess returns (mb_stdin_hdl,
-- mb_stdout_hdl, mb_stderr_hdl, ph), where
--
-- -- r <- createProcess (proc "ls" []) ---- -- To create a pipe from which to read the output of ls: -- --
-- (_, Just hout, _, _) <-
-- createProcess (proc "ls" []){ std_out = CreatePipe }
--
--
-- To also set the directory in which to run ls:
--
--
-- (_, Just hout, _, _) <-
-- createProcess (proc "ls" []){ cwd = Just "/home/bob",
-- std_out = CreatePipe }
--
--
-- Note that Handles provided for std_in,
-- std_out, or std_err via the UseHandle
-- constructor will be closed by calling this function. This is not
-- always the desired behavior. In cases where you would like to leave
-- the Handle open after spawning the child process, please use
-- createProcess_ instead. All created Handles are
-- initially in text mode; if you need them to be in binary mode then use
-- hSetBinaryMode.
--
-- ph contains a handle to the running process. On
-- Windows use_process_jobs can be set in CreateProcess in order
-- to create a Win32 Job object to monitor a process tree's progress. If
-- it is set then that job is also returned inside ph.
-- ph can be used to kill all running sub-processes. This
-- feature has been available since 1.5.0.0.
createProcess :: CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
-- | Cleans up the process.
--
-- This function is meant to be invoked from any application level
-- cleanup handler. It terminates the process, and closes any
-- CreatePipe handles.
cleanupProcess :: (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) -> IO ()
-- | Creates a new process to run the specified command with the given
-- arguments, and wait for it to finish. If the command returns a
-- non-zero exit code, an exception is raised.
--
-- If an asynchronous exception is thrown to the thread executing
-- callProcess, the forked process will be terminated and
-- callProcess will wait (block) until the process has been
-- terminated.
callProcess :: FilePath -> [String] -> IO ()
-- | Creates a new process to run the specified shell command. If the
-- command returns a non-zero exit code, an exception is raised.
--
-- If an asynchronous exception is thrown to the thread executing
-- callCommand, the forked process will be terminated and
-- callCommand will wait (block) until the process has been
-- terminated.
callCommand :: String -> IO ()
-- | Sends an interrupt signal to the process group of the given process.
--
-- On Unix systems, it sends the group the SIGINT signal.
--
-- On Windows systems, it generates a CTRL_BREAK_EVENT and will only work
-- for processes created using createProcess and setting the
-- create_group flag
interruptProcessGroupOf :: ProcessHandle -> IO ()
-- | This function is almost identical to createProcess. The only
-- differences are:
--
--