diff --git a/sw/supervision/pc_common.ml b/sw/supervision/pc_common.ml index b4ba138bb1d..36158f3710d 100644 --- a/sw/supervision/pc_common.ml +++ b/sw/supervision/pc_common.ml @@ -37,7 +37,7 @@ let my_open_process_in = fun cmd -> Unix.close in_write; pid, inchan -let buf_size = 1024 +let buf_size = 128 let run_and_log = fun log com -> let com = com ^ " 2>&1" in @@ -45,6 +45,11 @@ let run_and_log = fun log com -> let channel_out = GMain.Io.channel_of_descr (Unix.descr_of_in_channel com_stdout) in let cb = fun ev -> if List.mem `IN ev then begin + (* read one line, add the newline again and log it *) + let line = input_line com_stdout in + log (line ^ "\n"); + true + end else begin let buf = String.create buf_size in (* loop until input returns zero *) let rec log_input = fun out -> @@ -56,8 +61,6 @@ let run_and_log = fun log com -> end; in log_input com_stdout; - true - end else begin log (sprintf "\nDONE (%s)\n\n" com); false end in