I had a problem handling fork as follows, because the child process is returning Core_kernel.Std.never_returns, and the parent is trying to return ().
I get an error This expression has type unit but an expression was expected of type Core_kernel.Std.never_returns = Core_kernel.Nothing0.t. He seems unable to find a way to use this with help Core.Std.
open Core.Std
open Unix
let () =
let prog = "ls" in
let args = ["ls"; "-l"] in
match Unix.fork () with
| `In_the_child ->
Unix.exec ~prog:prog ~args:args ();
| `In_the_parent _ ->
(* continue on with the program *)
source
share