package spotlib

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Xunix.CommandDeprecatedSource

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.

Sourcetype 'st t
Sourceval shell : string -> 'st t

Execute a shell command using /bin/sh

Sourceval 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

Sourcetype 'a result = Unix.process_status * 'a
Sourceval fold : 'st t -> init:'st -> f:('st -> ([ `Out | `Err ] * [ `Read of string | `EOF ]) -> 'st) -> 'st result

Generic scanner

Sourceval iter : unit t -> f:(([ `Out | `Err ] * [ `Read of string | `EOF ]) -> unit) -> unit result

Iteration over stdout+stderr outputs

Sourceval print : ?prefix:string -> unit t -> unit result

Output to stdout and stderr of the command are printed to stdout and stderr resp.ly.

Sourceval ignore_output : unit t -> unit result

Completely ignore the outputs

Sourceval get_stdout : string list t -> string list result

Gather stdout lines. Stderr outputs are printed to stderr.

Sourceval get_all : string list t -> string list result

Gather stdout and stderr lines.

Result tools

Sourceval fail : ?name:string -> 'res result -> 'no_return
Sourceval from_exit : ?name:string -> 'res result -> int * 'res
Sourceval must_exit_with : ?name:string -> int -> 'res result -> 'res
Sourceval should_exit_with : int -> 'res result -> ('res, Unix.process_status * 'res) Vresult.t
OCaml

Innovation. Community. Security.