Module OS.Cmd
Running commands.
Command existence
Running commands
val run : ?err:fpath -> Cmd.t -> unit resultrun cmdruns the commandcmd.std{i,o,err}are connected to the invoking process' standard channels. Iferris specifiedstderris redirected to the given file (e.g.File.null).
val run_status : ?err:fpath -> Cmd.t -> [ `Exited of int ] resultrun_status cmdis like Running commands, but doesn't error on non-zero exit status.
Capturing standard output
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 ris:Ok vifr = Ok (v, (_, `Exited 0))Error _otherwise. Non`Exited 0statuses are turned into an error message.
val out_string : ?trim:bool -> run_out -> (string * run_status) resultout_string ~trim ocaptures the standard outputoas astring. Iftrimistrue(default) the result is passed throughString.trim.
val out_lines : ?trim:bool -> run_out -> (string list * run_status) resultout_lines ~trimis likeout_stringbut the result is cut on newlines ('\n').
val out_file : fpath -> run_out -> (unit * run_status) resultout_file f owrites the standard outputoto filef.
val out_stdout : run_out -> (unit * run_status) resultout_stdout oredirects the standard outputoto the current process standard output.
val to_string : ?trim:bool -> run_out -> string resultto_stringis(out_string ?trim o |> success).
val to_lines : ?trim:bool -> run_out -> string list resultto_lines ?trim ois(out_string ?trim o |> success).
val run_out : ?err:fpath -> Cmd.t -> run_outrun_out cmdrepresents the standard output of the command runcmd.std{i,err}are connected to the invoking prcoess stream and standard output can be consumed withto_string,to_linesorto_file. Iferris specifiedstderris redirected to the given file.