Unix.open_process does not expose pid of child

I need to run a process in parallel with OCaml. Unix.open_process provides a nice high-level API for doing so, but unfortunately it does not expose the PID of the forked child process:

I am wondering if there is a deeper reason for this, or if this is simply a design flaw? Where would I suggest a change of the API?

I would like the PID so I can check periodically from the parent process if the child is still running. In my context, some work done by the parent thread becomes obsolete in case the child terminates before the parent. It seems that the current API does not allow me to implement that pattern.

Use create_process instead.

–steve

4 Likes