Use Unix.open_process_in
function. It will spawn a process and return an input channel, that will allow you to read data from the process.
If you want to wait for the process to terminate, you can just read all the data (i.e., wait until the process pipe returns EOF), and then close the channel, e.g.,
(* [run cmd] runs a shell command, waits until it terminates, and
returns a list of strings that the process outputed *)
let run cmd =
let inp = Unix.open_process_in cmd in
let r = In_channel.input_lines inp in
In_channel.close inp; r
Working with non-terminating process is even easier.
You may also find interesting lwt library that has a very descent interface to multiprocessing. And async library is another asynchronous library that provide an excellent interface to multiprocessing. Although, this libraries are great, they are little bit advance, for simple cases standard Unix
module is enough.