From c848e6ae978f89abcc53a8d385f450bbc64b5b6e Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Tue, 7 Mar 2017 09:27:40 +0000 Subject: [PATCH] Print a message when waiting for jobs --- src/future.ml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/future.ml b/src/future.ml index be7d25de..aaca1a5e 100644 --- a/src/future.ml +++ b/src/future.ml @@ -420,12 +420,20 @@ module Scheduler = struct let () = at_exit (fun () -> - let pids = + let jobs = Hashtbl.fold running ~init:[] ~f:(fun ~key:_ ~data:job acc -> job :: acc) in - List.iter pids ~f:(fun job -> - let _, status = Unix.waitpid [] job.pid in - process_done job status ~exiting:true)) + match jobs with + | [] -> () + | first :: others -> + Format.eprintf "\nWaiting for the following jobs to finish: %t@." + (fun ppf -> + Format.fprintf ppf "[@{%d@}]" first.id; + List.iter others ~f:(fun job -> + Format.fprintf ppf ", [@{%d@}]" job.id)); + List.iter jobs ~f:(fun job -> + let _, status = Unix.waitpid [] job.pid in + process_done job status ~exiting:true)) let rec go_rec cwd log t = match (repr t).state with