Browse Source

Flush stdout on each message

 + Not much performance loose, since few messages are shown.
 + Allow more accurate debugging, since messages are displayed at the
 place they are in the code.
Leo 9 years ago
parent
commit
ac899a9324
2 changed files with 3 additions and 5 deletions
  1. 0 2
      src/licencing.ml
  2. 3 3
      src/messages.ml

+ 0 - 2
src/licencing.ml

@@ -1220,8 +1220,6 @@ let print ~cecill =
   in
 
   Messages.info "Choose your language 'Fr' or 'En': ";
-  (* XXX Be sure to show the message *)
-  Out_channel.(flush stdout);
 
   let ( warn, licence ) =
     def_lang ()

+ 3 - 3
src/messages.ml

@@ -95,7 +95,9 @@ let print ~color ~style message =
          | Underline -> underline_printf "%s" colored_msg
          | Normal -> printf "%s" colored_msg
       )
-    end
+    end;
+    (* Be sure to show the message *)
+    Out_channel.(flush stdout);
 ;;
 
 (* Behave in a conform way to verbosity
@@ -163,8 +165,6 @@ let rec confirm info =
   check_assume_yes ~f:(fun () ->
          print ~color:Cyan ~style:Normal info;
          print ~color:Cyan ~style:Normal "\n(Yes/No): ";
-         (* XXX Be sure to show the message *)
-         Out_channel.(flush stdout);
          let str_answer = In_channel.(input_line ~fix_win_eol:true stdin) in
          str_answer |> Option.map ~f:String.lowercase
          |> (function