抑制OCaml启动消息

时间:2014-08-15 05:28:19

标签: ocaml

我根据Real World OCaml's安装说明更新了.ocamlinit以使用以下设置:

#use "topfind";;
#thread;;
#camlp4o;;
#require "core.top";;
#require "core.syntax";;

运行utop工作正常,只是在开头产生一些额外的输出,但是ocaml会产生大量的启动消息:

/usr/lib/ocaml/threads: added to search path
/usr/lib/ocaml/unix.cma: loaded
/usr/lib/ocaml/threads/threads.cma: loaded
/usr/lib/ocaml/dynlink.cma: loaded
/usr/lib/ocaml/camlp4: added to search path
/usr/lib/ocaml/camlp4/camlp4o.cma: loaded
/usr/lib/ocaml/bigarray.cma: loaded
... (And so on, for ~50 lines or so!)
/home/jmu303/.opam/system/lib/herelib/pa_herelib.cma: loaded
# 

我可以抑制这些启动消息吗?

1 个答案:

答案 0 :(得分:1)

一种方法是告诉你以前没有进入交互式环境:

# Sys.interactive := false;
# #use "topfind";;
# Sys.interactive := true;

您可以看到Batteries toplevel初始化代码,以获取此方法的示例:https://github.com/ocaml-batteries-team/batteries-included/blob/master/ocamlinit