gpt4 book ai didi

unix - 使用 OCaml 收集外部命令的输出

转载 作者:行者123 更新时间:2023-12-04 01:30:03 26 4
gpt4 key购买 nike

调用外部命令并在 OCaml 中收集其输出的正确方法是什么?

在 Python 中,我可以这样做:

os.popen('cmd').read()

如何在 OCaml 中获取所有外部程序的输出?或者,更好的是,带有 Lwt 的 OCaml?

谢谢。

最佳答案

您要Unix.open_process_in ,这在 OCaml 系统手册 3.10 版的第 388 页中进行了描述。

关于unix - 使用 OCaml 收集外部命令的输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2214970/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com