data Command = MkCommand String (List String)
A program to run: its name (found on PATH) or path, and its arguments, each passed literally (no shell parsing, no globbing).
import System.Processdata Command = MkCommand String (List String)
A program to run: its name (found on PATH) or path, and its arguments, each passed literally (no shell parsing, no globbing).
data Output = MkOutput String String Int
The result of running a Command: what it wrote to standard output and standard error, and its exit code (0 = success; 127 = could not be started).
command : String -> List String -> Command
Build a Command. command "echo" ["hello", "world"] runs echo with two arguments and no shell.
run : Command -> Output with Process
Run a command and collect its Output. A NON-ZERO exit code is ordinary data, not an error; only a program that cannot be STARTED is special (it comes back with exit 127 and a message on stderr).
stdout : Output -> String
What the program wrote to standard output.
stderr : Output -> String
What the program wrote to standard error.
exitCode : Output -> Int
The program's exit code (0 = success, 127 = could not be started).