module OpamProcess: sig .. end
Process handling
type t = {
|
p_name :string; |
|
p_args :string list; |
|
p_pid :int; |
|
p_cwd :string; |
|
p_time :float; |
|
p_stdout :string option; |
|
p_stderr :string option; |
|
p_env :string option; |
|
p_info :string option; |
}
The type for processes
val create : ?info_file:string ->
?env_file:string ->
?stdout_file:string ->
?stderr_file:string ->
?env:string array -> verbose:bool -> string -> string list -> t
create cmd args create a new process to execute the command
cmd with arguments args. If stdout_file or stderr_file are
set, the channels are redirected to the corresponding files. The
outputs are discarded is verbose is set to false. The current
environment can also be overriden if env is set. The environment
which is used to run the process is recorded into env_file (if
set).
type result = {
|
r_code :int; |
|
r_duration :float; |
|
r_info :string; |
|
r_stdout :string list; |
|
r_stderr :string list; |
|
r_cleanup :string list; |
}
Process results
val wait : t -> result
wait p waits for the processus p to end and returns its results.
val run : ?env:string array ->
?verbose:bool -> ?name:string -> string -> string list -> result
run ~name cmd args synchronously call the command cmd with
arguments args. It waits until the process is finished. The file
name.info, name.env, name.out and name.err and are
created, and contains the process main description, the environment
variables, the standard output and the standard error.
val is_success : result -> bool
Is the process result a success ?
val is_failure : result -> bool
Is the process result a failure ?
val clean_files : result -> unit
Clean-up process result files
val read_lines : string -> string list
Misc
val string_of_result : result -> string
Pretty printing of process.