Skip to content

Commit a50c3f8

Browse files
Fix restoring stderr correctly
When running `ocaml-mdx` it would output warnings to the "corrected" files when running with `--output -`. Since warnings are emitted on stderr this should not be happening, which means that something was messing with stderr. It turns out yes, there is code which modifies stderr but also takes care of restoring it. Unfortunately a typo caused the backup to be stderr instead so restoring would redirect stderr to stdout.
1 parent 01818a1 commit a50c3f8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/top/mdx_top.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type directive = Directory of string | Load of string
2222

2323
let redirect ~f =
2424
let stdout_backup = Unix.dup Unix.stdout in
25-
let stderr_backup = Unix.dup Unix.stdout in
25+
let stderr_backup = Unix.dup Unix.stderr in
2626
let filename = Filename.temp_file "ocaml-mdx" "stdout" in
2727
let fd_out =
2828
Unix.openfile filename Unix.[ O_WRONLY; O_CREAT; O_TRUNC ] 0o600

0 commit comments

Comments
 (0)