Uwt_processProcess 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:
Lwt_process).Lwt_process)val shell : string -> commandA 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 = [ | `KeepThe file descriptor is left unchanged
*)| `Dev_nullConnect the file descriptor to /dev/null
| `CloseIt's now the same as `Dev_null
*)| `FD_copy of Unix.file_descrThe file descriptor is replaced by the given one
*)| `FD_move of Unix.file_descrThe file descriptor is replaced by the given one, which is then closed.
*)| `File_copy of Uwt.file| `File_move of Uwt.file| `Pipe_copy of Uwt.Pipe.t| `Pipe_move of Uwt.Pipe.t| `Stream_copy of Uwt.Stream.t| `Stream_move of Uwt.Stream.t ]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 ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stdout:redirection ->
?stderr:redirection ->
command ->
Unix.process_status Lwt.tExecutes the given command and returns its exit status. Unix.WSTOPPED is not supported by libuv at the moment. It will return either Unix.WSIGNALED or Unix.WEXITED
val pread :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stderr:redirection ->
command ->
string Lwt.tval pread_chars :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stderr:redirection ->
command ->
char Lwt_stream.tval pread_line :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stderr:redirection ->
command ->
string Lwt.tval pread_lines :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stderr:redirection ->
command ->
string Lwt_stream.tval pwrite :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdout:redirection ->
?stderr:redirection ->
command ->
string ->
unit Lwt.tval pwrite_chars :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdout:redirection ->
?stderr:redirection ->
command ->
char Lwt_stream.t ->
unit Lwt.tval pwrite_line :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdout:redirection ->
?stderr:redirection ->
command ->
string ->
unit Lwt.tval pwrite_lines :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdout:redirection ->
?stderr:redirection ->
command ->
string Lwt_stream.t ->
unit Lwt.tval pmap :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stderr:redirection ->
command ->
string ->
string Lwt.tval pmap_chars :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stderr:redirection ->
command ->
char Lwt_stream.t ->
char Lwt_stream.tval pmap_line :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stderr:redirection ->
command ->
string ->
string Lwt.tval pmap_lines :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stderr:redirection ->
command ->
string Lwt_stream.t ->
string Lwt_stream.ttype state = | RunningThe process is still running
*)| Exited of Unix.process_statusThe process has exited
*)State of a sub-process
class process_none : ?timeout:float -> ?uid:int -> ?gid:int -> ?env:string array -> ?cwd:
string -> ?stdin:redirection -> ?stdout:redirection -> ?stderr:redirection ->
command -> object ... endval open_process_none :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stdout:redirection ->
?stderr:redirection ->
command ->
process_noneval with_process_none :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stdout:redirection ->
?stderr:redirection ->
command ->
(process_none -> 'a Lwt.t) ->
'a Lwt.tclass process_in : ?timeout:float -> ?uid:int -> ?gid:int -> ?env:string array -> ?cwd:
string -> ?stdin:redirection -> ?stderr:redirection -> command -> object ... endval open_process_in :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stderr:redirection ->
command ->
process_inval with_process_in :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdin:redirection ->
?stderr:redirection ->
command ->
(process_in -> 'a Lwt.t) ->
'a Lwt.tclass process_out : ?timeout:float -> ?uid:int -> ?gid:int -> ?env:string array -> ?cwd:
string -> ?stdout:redirection -> ?stderr:redirection -> command -> object ... endval open_process_out :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdout:redirection ->
?stderr:redirection ->
command ->
process_outval with_process_out :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stdout:redirection ->
?stderr:redirection ->
command ->
(process_out -> 'a Lwt.t) ->
'a Lwt.tclass process : ?timeout:float -> ?uid:int -> ?gid:int -> ?env:string array -> ?cwd:
string -> ?stderr:redirection -> command -> object ... endval open_process :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stderr:redirection ->
command ->
processval with_process :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
?stderr:redirection ->
command ->
(process -> 'a Lwt.t) ->
'a Lwt.tclass process_full : ?timeout:float -> ?uid:int -> ?gid:int -> ?env:string array -> ?cwd:
string -> command -> object ... endval open_process_full :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
command ->
process_fullval with_process_full :
?timeout:float ->
?uid:int ->
?gid:int ->
?env:string array ->
?cwd:string ->
command ->
(process_full -> 'a Lwt.t) ->
'a Lwt.t