Module Xunix.CommandDeprecated Command invocation
Typical usage is:
starter |> scanner , for example shell "ls /" |> print
or
starter |> scanner |> result_checker , for example shell "ls /" |> get_stdout |> must_exist_with ~name:"ls /" 0
Starter
Starters invoke processes and returns a value of 'st t. You do not need to care about 'st: it is determined by a output scanner.
val shell : string -> 'st t Execute a shell command using /bin/sh
val execvp : string list -> 'st t Same as shell_command but it takes the command and arguments as a list of string, then directly executed by Unix.execvp.
Output scanner
Output scanner takes the result of a starter and scans its stdout+stderr output. After all the stdout+stderr outputs are sent to the scanner, it returns the final result of the scan and the process status
val fold :
'st t ->
init :'st ->
f :('st -> ([ `Out | `Err ] * [ `Read of string | `EOF ] ) -> 'st ) ->
'st result val iter :
unit t ->
f :(([ `Out | `Err ] * [ `Read of string | `EOF ] ) -> unit) ->
unit result Iteration over stdout+stderr outputs
val print : ?prefix :string -> unit t -> unit result Output to stdout and stderr of the command are printed to stdout and stderr resp.ly.
val ignore_output : unit t -> unit result Completely ignore the outputs
val get_stdout : string list t -> string list result Gather stdout lines. Stderr outputs are printed to stderr.
val get_all : string list t -> string list result Gather stdout and stderr lines.
Result tools
val fail : ?name :string -> 'res result -> 'no_return val from_exit : ?name :string -> 'res result -> int * 'res val must_exit_with : ?name :string -> int -> 'res result -> 'res