What exactly do you intend to do? Do you want to run it and forget about it? Then do fork / exec. Do you want to run it and wait for it to end, but otherwise do nothing? Then use Sys.command. Do you want to read / write? Then used Unix.open_process*(or Unix.create_process*).
For example, if I want to run lsand print the results, I can do this:
let ls = Unix.open_process_in "ls"
try
while true do
Printf.printf "%s\n" (input_line ls)
done
with End_of_file -> ()
Unix.close_process_in ls
source
share