module OpamProcess:sig
..end
type
t = {
|
p_name : |
(* |
Command name
| *) |
|
p_args : |
(* |
Command args
| *) |
|
p_pid : |
(* |
Process PID
| *) |
|
p_cwd : |
(* |
Process initial working directory
| *) |
|
p_time : |
(* |
Process start time
| *) |
|
p_stdout : |
(* |
stdout dump file
| *) |
|
p_stderr : |
(* |
stderr dump file
| *) |
|
p_env : |
(* |
dump environment variables
| *) |
|
p_info : |
(* |
dump process info
| *) |
|
p_metadata : |
(* |
Metadata associated to the process
| *) |
val create : ?info_file:string ->
?env_file:string ->
?allow_stdin:bool ->
?stdout_file:string ->
?stderr_file:string ->
?env:string array ->
?metadata:(string * string) list ->
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 : |
(* |
Process exit code
| *) |
|
r_duration : |
(* |
Process duration
| *) |
|
r_info : |
(* |
Process info
| *) |
|
r_stdout : |
(* |
Content of stdout dump file
| *) |
|
r_stderr : |
(* |
Content of stderr dump file
| *) |
|
r_cleanup : |
(* |
List of files to clean-up
| *) |
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 ->
?metadata:(string * string) list ->
?allow_stdin:bool -> 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
val is_failure : result -> bool
val clean_files : result -> unit
val read_lines : string -> string list
val string_of_result : ?color:OpamGlobals.text_style -> result -> string