Process management
This module allows you to spawn processes and communicate with them.
A command. The first field is the name of the executable and the second is the list of arguments. For example:
("ls", [|"ls"; "-l"|])
.
Notes:
"\000"
. For
example: ("", [|"echo"; "\000foo bar"|])
is the same as:
("", [|"echo"; "foo"; "bar"|])
.
A command executed with the shell. (with "/bin/sh -c <cmd>"
on
Unix and "cmd.exe /c <cmd>"
on Windows).
All the following functions take an optional argument
timeout
. If specified, after expiration, the process will be
sent a Unix.sigkill
signal and channels will be closed.
A file descriptor redirection. It describes how standard file descriptors are redirected in the child process.
Note: all optional redirection arguments default to `Keep
Executes the given command and returns its exit status.
#
| Running
| (* | The process is still running | *) |
(* | The process has exited | *) |
State of a sub-process
Pid of the sub-process
kill signum
sends signum
to the process if it is still
running.
Terminates the process. It is equivalent to kill Sys.sigkill
on Unix but also works on Windows (unlike kill).
Threads which wait for the sub-process to exit then returns its exit status
Threads which wait for the sub-process to exit then returns its resource usages
Closes the process and returns its exit status. This closes all channels used to communicate with the process