OpamProcessProcess and job handling, with logs, termination status, etc.
type command = private {cmd : string;args : string list;cmd_text : string option;cmd_dir : string option;cmd_env : string array option;cmd_stdin : bool option;cmd_stdout : string option;cmd_verbose : bool option;cmd_name : string option;cmd_metadata : (string * string) list option;}The type of shell commands
val command :
?env:string array ->
?verbose:bool ->
?name:string ->
?metadata:(string * string) list ->
?dir:string ->
?allow_stdin:bool ->
?stdout:string ->
?text:string ->
string ->
string list ->
commandBuilds a shell command for later execution.
val string_of_command : command -> stringval text_of_command : command -> string optionval is_verbose_command : command -> boolval make_command_text :
?color:OpamConsole.text_style ->
string ->
?args:string list ->
string ->
stringReturns a label suitable for printing the summary of running commands. First string is the topic (e.g. package), second the action (e.g. command name). Optional command arguments may be used for details (e.g. make action).
type t = {p_name : string;Command name
*)p_args : string list;Command args
*)p_pid : int;Process PID
*)p_cwd : string;Process initial working directory
*)p_time : float;Process start time
*)p_stdout : string option;stdout dump file
*)p_stderr : string option;stderr dump file
*)p_env : string option;dump environment variables
*)p_info : string option;dump process info
*)p_metadata : (string * string) list;Metadata associated to the process
*)p_verbose : bool;whether output of the process should be displayed
*)p_tmp_files : string list;temporary files that should be cleaned up upon completion
*)}The type for processes
type result = {r_code : int;Process exit code, or 256 on error
*)r_signal : int option;Signal received if the processed was killed
*)r_duration : float;Process duration
*)r_info : (string * string) list;Process info
*)r_stdout : string list;Content of stdout dump file
*)r_stderr : string list;Content of stderr dump file
*)r_cleanup : string list;List of files to clean-up
*)}Process results
run command synchronously call the command command.cmd with arguments command.args. It waits until the process is finished. The files name.info, name.env, name.out and name.err, with name = command.cmd_name are created, and contain the process main description, the environment variables, the standard output and the standard error. Don't forget to call cleanup result afterwards
Same as run, but doesn't wait. Use wait_one to wait and collect results; Don't forget to call cleanup result afterwards
Similar to run_background, except that no process is created, and a dummy process (suitable for dry_wait_one) is returned.
wait p waits for the processus p to end and returns its results. Be careful to handle Sys.Break
Like wait, but returns None immediately if the process hasn't ended
Wait for the first of the listed processes to terminate, and return its termination status
Similar to wait_one for simulations, to be used with dry_run_background
val interrupt : t -> unitSend SIGINT to a process (or SIGKILL on Windows)
val is_success : result -> boolIs the process result a success?
val is_failure : result -> boolIs the process result a failure?
val cleanup : ?force:bool -> result -> unitShould be called after process termination, to cleanup temporary files. Leaves artefacts in case OpamGlobals.debug is on and on failure, unless force has been set.
val check_success_and_cleanup : result -> boolLike is_success, with an added cleanup side-effect (as cleanup
~force:true). Use this when not returning 0 is not an error case: since the default behaviour is to cleanup only when the command returned 0, which is not what is expected in that case.
val string_of_result : ?color:OpamConsole.text_style -> result -> stringDetailed report on process outcome
val result_summary : result -> stringShort report on process outcome
module Job : sig ... endHigher-level interface to allow parallelism
type 'a job = 'a Job.Op.jobCurrent environment. On Windows, Cygwin installation binary path and git location path may be added to PATH. *
As OpamStd.Sys.resolve_command, except the default for ~env is default_env.