Здравствуйте.
Хочу направить вывод Arg.usage в stdout вместо stderr, не переделывая целиком свою старую программу. Вот что я попробовал:
Unix.dup2 Unix.stdout Unix.stderr; (* send output to stdout. *)
Arg.usage (Arg.align (hiddenhelp @ options)) “”
(После этого программа завершается, поэтому, полагаю, восстанавливать нам ничего не требуется…).
На Unix это работает, но в Windows вывода нет ни в stdout, ни в stderr. В статье о dup2 в документации Unix ничего не говорится про 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?