package b0

  1. Overview
  2. Docs

Tool spawns.

Tool spawns

type stdo = [
  1. | `Ui
  2. | `File of B0_std.Fpath.t
  3. | `Tee of B0_std.Fpath.t
]

The type for spawn standard outputs redirections.

  • `Ui redirects the output to the user interface of the build system (usually only shown in case of failure). Outputs are always first redirected to a file and read back by the program running the build on completion, this means that in the spawn program isatty(3) will be false on the fds.
  • `File p redirect the output to file path p.
  • `Tee p, is both `Ui and File `f.
type success_exits = int list

The list of process exit codes that indicate success. If the list is empty this any exit code.

type t

The type for process spawn operations.

env s is the environment in which s runs.

val relevant_env : t -> B0_std.Os.Env.assignments

relevant_env s are the assignements of env s that should be taken into account for caching.

val cwd : t -> B0_std.Fpath.t

cwd s is the cwd with which s runs.

val stdin : t -> B0_std.Fpath.t option

stdin s is the file s uses as stdin (if any).

val stdout : t -> stdo

stdout s is the redirection s uses for stdout.

val stderr : t -> stdo

stderr s is the redirection s uses for stderr.

val success_exits : t -> success_exits

success_exits s is the list of process exit codes s that indicate success.

val tool : t -> B0_std.Cmd.tool

tool t is the spawned tool. Note that this has to be a full path at that point.

val args : t -> B0_std.Cmd.t

args s are the spawned tool arguments.

val stdo_ui : t -> (string, string) result option

stdo_ui sr is the standard outputs redirection contents of s once it has executed (if any).

val set_stdo_ui : t -> (string, string) result option -> unit

set_stdo_ui w ui sets w's standard output redirection contents to ui.

val result : t -> (B0_std.Os.Cmd.status, string) result

result s is the spawn result of s.

val set_result : t -> (B0_std.Os.Cmd.status, string) result -> unit

set_result s e the spawn result of s to e.

Formatters

val pp_success_exits : int list B0_std.Fmt.t

pp_success_exits formats the success exits.

val pp_cmd : t B0_std.Fmt.t

pp_cmd formats the command issued by the spawn.

val pp_stdo_ui : elide:bool -> t B0_std.Fmt.t

pp_stdo_ui formats the standard output ui of the spawn. If elide is true elides long outputs.

val pp_result : (B0_std.Os.Cmd.status, string) result B0_std.Fmt.t

pp_result formats the command status of the spawn.

val pp : t B0_std.Fmt.t

pp formats a spawn.