Module Subprocess.Exec

The Exec module is exposed for starting processes without a managing scope. Exec.exec and Exec.shared_pipe exist for this purpose.

val exec : ('stdin, 'stdout, 'stderr) Core.Cmd.t -> ('stdin, 'stdout, 'stderr) Core.t

Start a process and return the handle (an instance of Subprocess.t). This process will need to be closed manually, but the recored carres around a close "method" (actually a closure) which, when applied to (), will close any open file descriptors attached to the process (except for those passed in as a channel).

Applying the close property of a Subprocess.t instance returns an instance of Exit.t.

val in_context : ('stdin, 'stdout, 'stderr) Core.Cmd.t -> f:(('stdin, 'stdout, 'stderr) Core.t -> 'a) -> Core.Exit.t * 'a

Open a command in context of a function, and close automaticall afterwards, automatically closing everything at the end

val shared_pipe : ('stdin, Core.stdout, Core.stderr) Core.Cmd.t -> ('stdin, Core.pipe, Core.stdout) Core.t

Same as exec, but recirects stdout and stderr to the same pipe. Similar to using 2>&1 | in the shell.

val shared_context : ('stdin, Core.stdout, Core.stderr) Core.Cmd.t -> f:(('stdin, Core.pipe, Core.stdout) Core.t -> 'a) -> Core.Exit.t * 'a

Same as in_context but with the redirection mentioned in shared_pipe.