Redirecting stderr to stdout on Windows

Hello.

I would like to have the output of Arg.usage appear on stdout instead of stderr, and I don’t want to re-work my whole (old) program. So I try:

Unix.dup2 Unix.stdout Unix.stderr; (* output on stdout instead. *)
Arg.usage (Arg.align (nohelp @ specs)) “”

(The program then exits, so we don’t need to restore anything, I think…).

This is fine on Unix, but on Windows no output is produced on either stdout or stderr. There is no note about Windows in the Unix documentation for dup2.

Any ideas?

IDK what’s going on with dup2 but you can probably use usage_string instead of usage.

Thanks! Not sure how I missed that.

I’m not seeing this not work - do you have a full repro (with compiler version, etc)?