안녕하세요.
오래된 프로그램 전체를 다시 짜지 않고 Arg.usage의 출력이 stderr 대신 stdout으로 가게 하고 싶어요. 이렇게 해 봤습니다:
Unix.dup2 Unix.stdout Unix.stderr; (* send output to stdout. *)
Arg.usage (Arg.align (hiddenhelp @ options)) “”
(프로그램이 그 뒤에 종료되니, 복원할 것은 없다고 생각하는데요…).
Unix에서는 되지만 Windows에서는 stdout과 stderr 어느 쪽에도 출력이 안 나옵니다. Unix 문서의 dup2 항목에는 Windows 관련 내용이 없네요.
어떤 방법이 있을까요?
영어에서 번역·원문 보기Hello.
I'd like the output produced by Arg.usage to be written to stdout rather than stderr, without having to restructure my entire older program. Here's my attempt:
Unix.dup2 Unix.stdout Unix.stderr; (* send output to stdout. *)
Arg.usage (Arg.align (hiddenhelp @ options)) “”
(The program exits afterwards, so I assume there's nothing we must restore…).
On Unix this works, but Windows produces nothing on either stdout or stderr. The entry for dup2 in the Unix documentation doesn't mention anything about Windows.
Any suggestions?