OS.CmdRunning commands.
exists cmd is true if the executable of cmd can be found in the path and false otherwise.
must_exist cmd is cmd if the executable of cmd can be found in the path and an error otherwise.
run cmd runs the command cmd. std{i,o,err} are connected to the invoking process' standard channels. If err is specified stderr is redirected to the given file (e.g. File.null).
run_status cmd is like run, but doesn't error on non-zero exit status.
type run_status = Cmd.t * [ `Exited of int ]The type for run statuses, the command that was run and the run status.
val success : ('a * run_status) result -> 'a resultsuccess r is:
Ok v if r = Ok (v, (_, `Exited 0))Error _ otherwise. Non `Exited 0 statuses are turned into an error message.val out_string : ?trim:bool -> run_out -> (string * run_status) resultout_string ~trim o captures the standard output o as a string. If trim is true (default) the result is passed through String.trim.
val out_lines : ?trim:bool -> run_out -> (string list * run_status) resultout_lines ~trim is like out_string but the result is cut on newlines ('\n').
val out_file : fpath -> run_out -> (unit * run_status) resultout_file f o writes the standard output o to file f.
val out_stdout : run_out -> (unit * run_status) resultout_stdout o redirects the standard output o to the current process standard output.
to_lines ?trim o is (out_string ?trim o |> success).