stack-1.3.2: The Haskell Tool Stack

Safe Haskell | None
Language | Haskell2010

System.Process.Run

Description

Run sub-processes.

Synopsis

- runCmd :: forall m. (MonadLogger m, MonadIO m, MonadBaseControl IO m) => Cmd -> Maybe Text -> m ()
- runCmd' :: forall m. (MonadLogger m, MonadIO m, MonadBaseControl IO m) => (CreateProcess -> CreateProcess) -> Cmd -> Maybe Text -> m ()
- callProcess :: (MonadIO m, MonadLogger m) => Cmd -> m ()
- callProcess' :: (MonadIO m, MonadLogger m) => (CreateProcess -> CreateProcess) -> Cmd -> m ()
- callProcessInheritStderrStdout :: (MonadIO m, MonadLogger m) => Cmd -> m ()
- callProcessObserveStdout :: (MonadIO m, MonadLogger m) => Cmd -> m String
- createProcess' :: (MonadIO m, MonadLogger m) => String -> (CreateProcess -> CreateProcess) -> Cmd -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle)
- data ProcessExitedUnsuccessfully :: *
- data Cmd = Cmd {
  - cmdDirectoryToRunIn :: Maybe (Path Abs Dir)
  - cmdCommandToRun :: FilePath
  - cmdEnvOverride :: EnvOverride
  - cmdCommandLineArguments :: [String]
  }

# Documentation

runCmd #

Arguments

:: forall (m :: * -> *). (MonadLogger m, MonadIO m, MonadBaseControl IO m) |
=> Cmd |
-> Maybe Text | optional additional error message
-> m () |

Run the given command in the given directory, inheriting stdout and stderr.

If it exits with anything but success, prints an error and then calls `exitWith` to exit the program.

runCmd' #

Arguments

:: forall (m :: * -> *). (MonadLogger m, MonadIO m, MonadBaseControl IO m) |
=> (CreateProcess -> CreateProcess) |
-> Cmd |
-> Maybe Text | optional additional error message
-> m () |

callProcess :: (MonadIO m, MonadLogger m) => Cmd -> m () #

Like `callProcess`, but takes an optional working directory and environment override, and throws `ProcessExitedUnsuccessfully` if the process exits unsuccessfully and a `ReadProcessException` if the executable is not found.

Inherits stdout and stderr.

callProcess' :: (MonadIO m, MonadLogger m) => (CreateProcess -> CreateProcess) -> Cmd -> m () #

Like `callProcess`, but takes an optional working directory and environment override, and throws `ProcessExitedUnsuccessfully` if the process exits unsuccessfully and a `ReadProcessException` if the executable is not found.

Inherits stdout and stderr.

callProcessInheritStderrStdout :: (MonadIO m, MonadLogger m) => Cmd -> m () #

callProcessObserveStdout :: (MonadIO m, MonadLogger m) => Cmd -> m String #

createProcess' :: (MonadIO m, MonadLogger m) => String -> (CreateProcess -> CreateProcess) -> Cmd -> m (Maybe Handle, Maybe Handle, Maybe Handle, ProcessHandle) #

Like `createProcess_`, but taking a `Cmd`. Note that the `Handle`s provided by `UseHandle` are not closed automatically.

data ProcessExitedUnsuccessfully :: * #

Indicates that a process exited with an non-success exit code.

Since 0.1.7

Instances

Show ProcessExitedUnsuccessfully |
Methods showsPrec :: Int -> ProcessExitedUnsuccessfully -> ShowS # show :: ProcessExitedUnsuccessfully -> String # showList :: [ProcessExitedUnsuccessfully] -> ShowS #
Exception ProcessExitedUnsuccessfully |
Methods toException :: ProcessExitedUnsuccessfully -> SomeException # fromException :: SomeException -> Maybe ProcessExitedUnsuccessfully # displayException :: ProcessExitedUnsuccessfully -> String #

data Cmd #

Cmd holds common infos needed to running a process in most cases

Constructors

Cmd |
Fields cmdDirectoryToRunIn :: Maybe (Path Abs Dir) directory to run in cmdCommandToRun :: FilePath command to run cmdEnvOverride :: EnvOverride cmdCommandLineArguments :: [String] command line arguments