Module JoinTextProc.Sync

module Sync: sig .. end


Synchronous list-based interface

The functions below all return means to control the child process and (i. e. a wait/kill pair). The wait synchronous channel returns the child status after termination, plus lists of lines.

Input to the forked command also is a list of lines.

Depending on the function input may be absent, as output or error can also be (then replaced by empty lists []).

type text = string list 
Text is a list of lines
type result = {
   st : Unix.process_status; (*Child status*)
   out : text; (*Standard output of child*)
   err : text; (*Standard error of child*)
}
type t = {
   wait : unit -> result; (*Get result (will block)*)
   kill : int -> unit; (*Kill child*)
   gkill : int -> unit; (*Kill child group*)
}
val command : string -> string array -> t
Analogous of JoinProc.command. Standard channels stdin, stdout, and stderr are the ones of the parent process. Accordingly, the out and err lists are empty.
val open_in : string -> string array -> t
Analogous of JoinProc.open_in. Standard output of child process is the out list.
val open_in_out : string -> string array -> text -> t
Analogous of JoinProc.open_in_out. The child process reads it standard input from third argument. Standard output of child process is the out list.
val open_full : string -> string array -> text -> t
Analogous of JoinProc.open_full. Input of child is read from third argument, while standard output and error are the out and err lists.