Skip to content

Commit 7530368

Browse files
committed
Properly flush -time-file at exit
Without this it's possible that some output will be omitted. For instance ExtensionalFunctionRepresentative (1 command file in stdlib) sometimes has no timing info. We could try to explicitly call flushing after running coq eg in ccompile, but getting all time-file users seems awkward and not worth the bother.
1 parent ebea542 commit 7530368

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

toplevel/vernac.ml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,15 @@ type time_output =
4040

4141
let make_time_output = function
4242
| Coqargs.ToFeedback -> ToFeedback
43-
| ToFile f -> ToChannel (Format.formatter_of_out_channel (open_out f))
43+
| ToFile f ->
44+
let ch = open_out f in
45+
let fch = Format.formatter_of_out_channel ch in
46+
let close () =
47+
Format.pp_print_flush fch ();
48+
close_out ch
49+
in
50+
at_exit close;
51+
ToChannel fch
4452

4553
module State = struct
4654

0 commit comments

Comments
 (0)