buildbox-2.0.0.1: Rehackable components for writing buildbots and test harnesses.

Safe HaskellSafe-Infered

BuildBox.Command.System

Contents

Description

Running system commands. On some platforms this may cause the command to be executed directly, so shell tricks won't work. The Build monad can be made to log commands executed with all versions of system by setting buildConfigLogSystem in the BuildConfig passed to runBuildPrintWithConfig.

We define a lot of wrappers because executing system commands is the bread-and-butter of buildbots, and we usually need all the versions...

Synopsis

Documentation

Wrappers

system :: String -> Build ExitCodeSource

Run a system command, returning its exit code.

ssystem :: String -> Build ()Source

Run a successful system command. If the exit code is ExitFailure then throw an error in the Build monad.

qsystem :: String -> Build ExitCodeSource

Quietly run a system command, returning its exit code.

qssystem :: String -> Build ()Source

Quietly run a successful system command. If the exit code is ExitFailure then throw an error in the Build monad.

ssystemOut :: String -> Build StringSource

Run a successful system command, returning what it wrote to its stdout. If anything was written to stderr then treat that as failure. If it fails due to writing to stderr or returning ExitFailure then throw an error in the Build monad.

qssystemOut :: String -> Build StringSource

Quietly run a successful system command, returning what it wrote to its stdout. If anything was written to stderr then treat that as failure. If it fails due to writing to stderr or returning ExitFailure then throw an error in the Build monad.

systemTee :: Bool -> String -> String -> Build (ExitCode, String, String)Source

Like systemTeeIO, but in the Build monad.

systemTeeLog :: Bool -> String -> Log -> Build (ExitCode, Log, Log)Source

Like systemTeeLogIO, but in the Build monad.

ssystemTee :: Bool -> String -> String -> Build ()Source

Like systemTeeIO, but in the Build monad and throw an error if it returns ExitFailure.

systemTeeIO :: Bool -> String -> String -> IO (ExitCode, String, String)Source

Like systemTeeLogIO, but with strings.

The real function

systemTeeLogIOSource

Arguments

:: Bool

Whether stdout and stderr should be forwarded to the parent process.

-> String

Command to run.

-> Log

What to pass to the command's stdin.

-> IO (ExitCode, Log, Log) 

Run a system command, returning its ExitCode and what was written to stdout and stderr.