당신이 유닉스 시스템에 있다면 당신은 표준 출력 "을/dev/null"로 리디렉션 할 수 있습니다. 이런 식으로 뭔가를 작동 할 수 있습니다 : 당신이 다른 시간에 표준 출력을 사용해야하는 경우
$ ocaml
OCaml version 4.01.0
# #load "unix.cma";;
# Sys.system "echo unwanted message";;
Error: Unbound value Sys.system
# Sys.command "echo unwanted message";;
unwanted message
- : int = 0
# let nullout = open_out "/dev/null" in
Unix.dup2 (Unix.descr_of_out_channel nullout) Unix.stdout;;
Sys.command "echo unwanted message";;
Sys.command "echo error message >&2";;
error message
, 당신은이 : 여기
let nullout = open_out "/dev/null" in
Unix.dup2 (Unix.descr_of_out_channel nullout) Unix.stdout
그것 (OS의 X에 적어도 나를 위해) 작동하는지 보여주는 세션의 더 나쁜 문제. 당신은의 여분의 사용과 함께 이전의 상태로 stdout을 리디렉션 할 수 있다고 생각합니다.
운이 없습니다. 명시 적으로 말하면 라이브러리는 표준 파일 디스크립터로 절대 출력해서는 안된다. 나는 [여기] (https://github.com/mirage/ocaml-dns/issues/36) 버그 보고서를 제출했다. –