Module Rig_bin.Proc
Processes: starting them, learning how they ended, ending them.
Used from one thread: the launchers run no other.
val spawn :
?env:string array ->
string ->
string array ->
stdin:Unix.file_descr ->
stdout:Unix.file_descr ->
stderr:Unix.file_descr ->
intspawn ~env prog args ~stdin ~stdout ~stderr starts prog, found through PATH, with args and env (defaults to this process's), and is its pid. Raises Unix.Unix_error if it cannot be run.
val pipe : unit -> Unix.file_descr * Unix.file_descrpipe () is a pipe whose ends close on exec.
val write : Unix.file_descr -> string -> unitwrite fd s writes s on fd, ignoring the system's errors: a reader that is gone reads nothing.
val fd_number : Unix.file_descr -> intfd_number fd is fd's number, as RIG_REMOTE_REPORT names it.
val inherited : Unix.file_descr -> (unit -> 'a) -> 'ainherited fd f is f (), with fd passed on to the processes f starts.
val reap : int -> Unix.process_status optionreap pid is how pid ended, if it has, without waiting.
val signal : int -> int -> unitsignal pid s sends signal s to pid. pid must not have been reaped: a reaped pid may name another process.
val kill : int -> unitkill pid is signal pid Sys.sigkill.
val cause : Unix.process_status -> stringcause st is "exited with status N", or "killed by SIGNAME", SIGNAME a POSIX signal's name or "signal N".
val status : Unix.process_status -> intstatus st is the exit status a shell shows for st: its own, or 128 + N for signal N.
Signals
val signals : int list -> unitsignals interrupts handles SIGCHLD, SIGPIPE and each signal of interrupts: each wakes wait, and the first interrupt is noted. A write to a pipe that has no reader fails instead of ending the process. A signal ignored when the process started stays ignored, except SIGCHLD: a launcher must see its children end.
val wait : ?until:float -> Line.reader list -> unitwait ~until rs returns once a reader of rs has bytes or its end, a signal of signals came, or the time is until (defaults to never).
val interrupted : unit -> int optioninterrupted () is the first interrupt the process got, at the first call after a wait it woke, and None at every other call.
val die_by : int -> 'adie_by s restores s's default action and sends it to this process.