package opam-core

  1. Overview
  2. Docs

Higher-level interface to allow parallelism

module Op : sig ... end

Open type and add combinators. Meant to be opened

val run : 'a Op.job -> 'a

Sequential run of a job

val dry_run : 'a Op.job -> 'a

Same as run but doesn't actually run any shell command, and feed a dummy result to the cont.

val catch : (exn -> 'a Op.job) -> (unit -> 'a Op.job) -> 'a Op.job

Catch exceptions raised within a job

val ignore_errors : default:'a -> ?message:string -> (unit -> 'a Op.job) -> 'a Op.job

Ignore all non-fatal exceptions raised by job and return default

val finally : (unit -> unit) -> (unit -> 'a Op.job) -> 'a Op.job

Register an exception-safe finaliser in a job. finally job fin is equivalent to catch job (fun e -> fin (); raise e) @@+ fun r -> fin (); Done r

val of_list : ?keep_going:bool -> command list -> (command * result) option Op.job

Converts a list of commands into a job that returns None on success, or the first failed command and its result. Unless keep_going is true, stops on first error.

val of_fun_list : ?keep_going:bool -> (unit -> command) list -> (command * result) option Op.job

As of_list, but takes a list of functions that return the commands. The functions will only be evaluated when the command needs to be run.

val seq : ('a -> 'a Op.job) list -> 'a -> 'a Op.job

Returns the job made of the the given homogeneous jobs run sequentially

val seq_map : ('a -> 'b Op.job) -> 'a list -> 'b list Op.job

Sequentially maps jobs on a list

val with_text : string -> 'a Op.job -> 'a Op.job

Sets and overrides text of the underlying commands