Library
Module
Module type
Parameter
Class
Class type
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"|])
.
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 = [
| `Keep
The file descriptor is left unchanged
*)| `Dev_null
Connect the file descriptor to /dev/null
| `Close
The file descriptor is closed
*)| `FD_copy of Unix.file_descr
The file descriptor is replaced by the given one
*)| `FD_move of Unix.file_descr
The file descriptor is replaced by the given one, which is then 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
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.
val pread :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stderr:redirection ->
command ->
string Lwt.t
val pread_chars :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stderr:redirection ->
command ->
char Lwt_stream.t
val pread_line :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stderr:redirection ->
command ->
string Lwt.t
val pread_lines :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stderr:redirection ->
command ->
string Lwt_stream.t
val pwrite :
?timeout:float ->
?env:string array ->
?stdout:redirection ->
?stderr:redirection ->
command ->
string ->
unit Lwt.t
val pwrite_chars :
?timeout:float ->
?env:string array ->
?stdout:redirection ->
?stderr:redirection ->
command ->
char Lwt_stream.t ->
unit Lwt.t
val pwrite_line :
?timeout:float ->
?env:string array ->
?stdout:redirection ->
?stderr:redirection ->
command ->
string ->
unit Lwt.t
val pwrite_lines :
?timeout:float ->
?env:string array ->
?stdout:redirection ->
?stderr:redirection ->
command ->
string Lwt_stream.t ->
unit Lwt.t
val pmap :
?timeout:float ->
?env:string array ->
?stderr:redirection ->
command ->
string ->
string Lwt.t
val pmap_chars :
?timeout:float ->
?env:string array ->
?stderr:redirection ->
command ->
char Lwt_stream.t ->
char Lwt_stream.t
val pmap_line :
?timeout:float ->
?env:string array ->
?stderr:redirection ->
command ->
string ->
string Lwt.t
val pmap_lines :
?timeout:float ->
?env:string array ->
?stderr:redirection ->
command ->
string Lwt_stream.t ->
string Lwt_stream.t
class process_none : ?timeout:float -> ?env:string array -> ?stdin:redirection -> ?stdout:
redirection -> ?stderr:redirection -> command -> object ... end
val open_process_none :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stdout:redirection ->
?stderr:redirection ->
command ->
process_none
val with_process_none :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stdout:redirection ->
?stderr:redirection ->
command ->
(process_none -> 'a Lwt.t) ->
'a Lwt.t
class process_in : ?timeout:float -> ?env:string array -> ?stdin:redirection -> ?stderr:
redirection -> command -> object ... end
val open_process_in :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stderr:redirection ->
command ->
process_in
val with_process_in :
?timeout:float ->
?env:string array ->
?stdin:redirection ->
?stderr:redirection ->
command ->
(process_in -> 'a Lwt.t) ->
'a Lwt.t
class process_out : ?timeout:float -> ?env:string array -> ?stdout:redirection -> ?stderr:
redirection -> command -> object ... end
val open_process_out :
?timeout:float ->
?env:string array ->
?stdout:redirection ->
?stderr:redirection ->
command ->
process_out
val with_process_out :
?timeout:float ->
?env:string array ->
?stdout:redirection ->
?stderr:redirection ->
command ->
(process_out -> 'a Lwt.t) ->
'a Lwt.t
class process : ?timeout:float -> ?env:string array -> ?stderr:redirection -> command -> object ... end
val open_process :
?timeout:float ->
?env:string array ->
?stderr:redirection ->
command ->
process
val with_process :
?timeout:float ->
?env:string array ->
?stderr:redirection ->
command ->
(process -> 'a Lwt.t) ->
'a Lwt.t
class process_full : ?timeout:float -> ?env:string array -> command -> object ... end
val open_process_full :
?timeout:float ->
?env:string array ->
command ->
process_full
val with_process_full :
?timeout:float ->
?env:string array ->
command ->
(process_full -> 'a Lwt.t) ->
'a Lwt.t