我正在尝试捕获使用Posix.Process.execp
. 我移植了我在 stackoverflow 上找到的一些 C 代码,并且可以捕获一次执行的输出,但是我无法获得第二次执行的输出。
这是我的功能:
(* Runs a command c (command and argument list) using Posix.Process.execp. *)
(* If we successfully run the program, we return the lines output to stdout *)
(* in a list, along with SOME of the exit code. *)
(* If we fail to run the program, we return the error message in the list *)
(* and NONE. *)
fun execpOutput (c : string * string list) : (string list …
Run Code Online (Sandbox Code Playgroud)