Skip to content

Instantly share code, notes, and snippets.

@denismerigoux
Created February 10, 2022 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denismerigoux/b07dde85b34cffb7edb15e90446c60e3 to your computer and use it in GitHub Desktop.
Save denismerigoux/b07dde85b34cffb7edb15e90446c60e3 to your computer and use it in GitHub Desktop.
diff --git a/compiler/driver.ml b/compiler/driver.ml
index 2dac8dc..b315a19 100644
--- a/compiler/driver.ml
+++ b/compiler/driver.ml
@@ -175,8 +175,11 @@ let driver (source_file : Pos.input_file) (debug : bool) (unstyled : bool)
match output_file with
| Some f ->
let oc = open_out f in
- (Format.formatter_of_out_channel oc, fun _ -> close_out oc)
- | None -> (Format.std_formatter, fun _ -> ())
+ ( Format.formatter_of_out_channel oc,
+ fun _ ->
+ Format.print_flush ();
+ close_out oc )
+ | None -> (Format.std_formatter, fun _ -> Format.print_flush ())
in
if Option.is_some ex_scope then
Format.fprintf fmt "%a\n" Scopelang.Print.format_scope
@@ -200,8 +203,11 @@ let driver (source_file : Pos.input_file) (debug : bool) (unstyled : bool)
match output_file with
| Some f ->
let oc = open_out f in
- (Format.formatter_of_out_channel oc, fun _ -> close_out oc)
- | None -> (Format.std_formatter, fun _ -> ())
+ ( Format.formatter_of_out_channel oc,
+ fun _ ->
+ Format.print_flush ();
+ close_out oc )
+ | None -> (Format.std_formatter, fun _ -> Format.print_flush ())
in
if Option.is_some ex_scope then
Format.fprintf fmt "%a\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment