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"|])
- if the name is the empty string, then the first argument will be used. You should specify a name only if you do not want the executable to be searched in the PATH. On Windows the only way to enable automatic seach in PATH is to pass an empty name.
- it is possible to ``inline'' an argument, i.e. split it into multiple arguments. To do that prefix it with
"\000". For example:
("", [|"echo"; "\000foo bar"|])
is the same as:
("", [|"echo"; "foo"; "bar"|])
val shell : string -> command
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.
type redirection = [
File descriptor redirections. These are used with the
~stderr arguments below to specify how the standard file descriptors should be redirected in the child process.
`Keep: point to the same file as in the parent.
`Dev_null: redirect to
`Close: close the file descriptor.
`FD_copy fdredirect to the file pointed to by
`FD_move fdredirect to the file pointed to by
fdis then closed.
All optional redirection arguments default to
val exec : ?timeout:float -> ?env:string array -> ?stdin:redirection -> ?stdout:redirection -> ?stderr:redirection -> command -> Unix.process_status Lwt.t
Executes the given command and returns its exit status.
type state =
The process is still running*)
The process has exited*)
State of a sub-process