package current

  1. Overview
  2. Docs

Helper functions for spawning sub-processes.

val pp_cmd : Stdlib.Format.formatter -> Lwt_process.command -> unit

The default command printer used in exec and check_output to write the command to the job's log.

val exec : ?cwd:Fpath.t -> ?stdin:string -> ?pp_cmd:(Stdlib.Format.formatter -> Lwt_process.command -> unit) -> ?pp_error_command:(Stdlib.Format.formatter -> unit) -> cancellable:bool -> job:Job.t -> Lwt_process.command -> unit or_error Lwt.t

exec ~job cmd uses Lwt_process to run cmd, with output to job's log.

  • parameter cwd

    Sets the current working directory for this command.

  • parameter cancellable

    Should the process be terminated if the job is cancelled?

  • parameter stdin

    Data to write to stdin before closing it.

  • parameter pp_cmd

    Format the command for the job's log and error message.

  • parameter pp_error_command

    Format the command for an error message. The default is to print "Command $cmd".

val check_output : ?cwd:Fpath.t -> ?stdin:string -> ?pp_cmd:(Stdlib.Format.formatter -> Lwt_process.command -> unit) -> ?pp_error_command:(Stdlib.Format.formatter -> unit) -> cancellable:bool -> job:Job.t -> Lwt_process.command -> string or_error Lwt.t

Like exec, but return the child's stdout as a string rather than writing it to the log.

val with_tmpdir : ?prefix:string -> (Fpath.t -> 'a Lwt.t) -> 'a Lwt.t

with_tmpdir fn creates a temporary directory, runs fn tmpdir, and then deletes the directory (recursively).

  • parameter prefix

    Allows giving the directory a more meaningful name (for debugging).


Innovation. Community. Security.