Cmd
Cmd
Represents a command to be executed in a child process.
Err
Errors from executing a command.
outputErrToStr : ( Output, Err ) -> Str
Output
Represents the output of a command.
new : Str -> Cmd
Create a new command to execute the given program in a child process.
arg : Cmd, Str -> Cmd
Add a single argument to the command.
! Shell features like variable subsitition (e.g. $FOO
), glob patterns (e.g. *.txt
), ... are not available.
# Represent the command "ls -l" Cmd.new "ls" |> Cmd.arg "-l"
args : Cmd, List Str -> Cmd
Add multiple arguments to the command.
! Shell features like variable subsitition (e.g. $FOO
), glob patterns (e.g. *.txt
), ... are not available.
# Represent the command "ls -l -a" Cmd.new "ls" |> Cmd.args ["-l", "-a"]
env : Cmd, Str, Str -> Cmd
Add a single environment variable to the command.
# Run "env" and add the environment variable "FOO" with value "BAR" Cmd.new "env" |> Cmd.env "FOO" "BAR"
envs : Cmd, List ( Str, Str ) -> Cmd
Add multiple environment variables to the command.
# Run "env" and add the variables "FOO" and "BAZ" Cmd.new "env" |> Cmd.envs [("FOO", "BAR"), ("BAZ", "DUCK")]
clearEnvs : Cmd -> Cmd
Clear all environment variables, and prevent inheriting from parent, only the environment variables provided to command are available to the child.
# Represents "env" with only "FOO" environment variable set Cmd.new "env" |> Cmd.clearEnvs |> Cmd.env "FOO" "BAR"
output : Cmd -> Task Output [ CmdOutputError ( Output, Err ) ]
Execute command and capture stdout and stderr
Stdin is not inherited from the parent and any attempt by the child process to read from the stdin stream will result in the stream immediately closing.
status : Cmd -> Task {} [CmdError Err]
Execute command and inherit stdin, stdout and stderr from parent
exec : Str, List Str -> Task {} [CmdError Err]
Execute command and inherit stdin, stdout and stderr from parent
# Call echo to print "hello world" Cmd.exec! "echo" ["hello world"]