4
我遇到了以下列方式fork fork失敗的問題,因爲子進程返回Core_kernel.Std.never_returns
,並且父級正試圖返回()
。OCaml Core_unix.fork與Core_unix.exec永遠不會返回
我收到錯誤This expression has type unit but an expression was expected of type Core_kernel.Std.never_returns = Core_kernel.Nothing0.t
。似乎無法找到與Core.Std
這樣做的propper方式。
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 *)