From 7fa76b4a40d058b448437465e21e607020469956 Mon Sep 17 00:00:00 2001 From: Alan Hu Date: Sat, 5 Sep 2020 15:03:40 -0400 Subject: [PATCH 1/6] Fix issue #3737 Signed-off-by: Alan Hu --- src/dune_engine/scheduler.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dune_engine/scheduler.ml b/src/dune_engine/scheduler.ml index 8e50b362f65..85a4d4f4a08 100644 --- a/src/dune_engine/scheduler.ml +++ b/src/dune_engine/scheduler.ml @@ -702,10 +702,10 @@ end = struct let fiber = Fiber.Var.set t_var t (fun () -> Fiber.with_error_handler f ~on_error) in - Console.Status_line.set (Fun.const None); match Fiber.run fiber ~iter with | res -> assert (Event.pending_jobs () = 0); + Console.Status_line.set (Fun.const None); Ok res | exception Abort err -> Error err | exception exn -> Error (Exn (Exn_with_backtrace.capture exn)) From d33589de2971b48e4eaf6198b7b7223176335838 Mon Sep 17 00:00:00 2001 From: Alan Hu Date: Tue, 15 Sep 2020 21:31:42 -0400 Subject: [PATCH 2/6] =?UTF-8?q?Also=20clear=20status=20line=20in=20case=20?= =?UTF-8?q?of=20error,=20as=20J=C3=A9r=C3=A9mie=20Dimino=20requested?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alan Hu --- src/dune_engine/scheduler.ml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/dune_engine/scheduler.ml b/src/dune_engine/scheduler.ml index 85a4d4f4a08..5832fd315b8 100644 --- a/src/dune_engine/scheduler.ml +++ b/src/dune_engine/scheduler.ml @@ -705,21 +705,21 @@ end = struct match Fiber.run fiber ~iter with | res -> assert (Event.pending_jobs () = 0); - Console.Status_line.set (Fun.const None); Ok res | exception Abort err -> Error err | exception exn -> Error (Exn (Exn_with_backtrace.capture exn)) let run_and_cleanup t f = let res = run t f in - ( match res with - | Error Files_changed -> - Console.Status_line.set (fun () -> - Some - (Pp.seq - (Pp.tag User_message.Style.Error (Pp.verbatim "Had errors")) - (Pp.verbatim ", killing current build..."))) - | _ -> () ); + Console.Status_line.set + (Fun.const + ( match res with + | Error Files_changed -> + Some + (Pp.seq + (Pp.tag User_message.Style.Error (Pp.verbatim "Had errors")) + (Pp.verbatim ", killing current build...")) + | _ -> None )); match kill_and_wait_for_all_processes t () with | Got_signal -> Error Got_signal | Ok -> res From 1e38bb8592cce944fa75d60b29cf264ab968fbf2 Mon Sep 17 00:00:00 2001 From: Alan Hu Date: Wed, 16 Sep 2020 10:08:59 -0400 Subject: [PATCH 3/6] Use let to split up long expression Signed-off-by: Alan Hu --- src/dune_engine/scheduler.ml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/dune_engine/scheduler.ml b/src/dune_engine/scheduler.ml index 5832fd315b8..a294b534ba3 100644 --- a/src/dune_engine/scheduler.ml +++ b/src/dune_engine/scheduler.ml @@ -711,15 +711,16 @@ end = struct let run_and_cleanup t f = let res = run t f in - Console.Status_line.set - (Fun.const - ( match res with - | Error Files_changed -> - Some - (Pp.seq - (Pp.tag User_message.Style.Error (Pp.verbatim "Had errors")) - (Pp.verbatim ", killing current build...")) - | _ -> None )); + let opt = + match res with + | Error Files_changed -> + Some + (Pp.seq + (Pp.tag User_message.Style.Error (Pp.verbatim "Had errors")) + (Pp.verbatim ", killing current build...")) + | _ -> None + in + Console.Status_line.set (Fun.const opt); match kill_and_wait_for_all_processes t () with | Got_signal -> Error Got_signal | Ok -> res From c3eb8f3667e2fcfb343077fe026961fafbede721 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Mon, 21 Sep 2020 10:42:31 +0100 Subject: [PATCH 4/6] opt --> status_line Signed-off-by: Jeremie Dimino --- src/dune_engine/scheduler.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dune_engine/scheduler.ml b/src/dune_engine/scheduler.ml index a294b534ba3..9ca52c6b8a2 100644 --- a/src/dune_engine/scheduler.ml +++ b/src/dune_engine/scheduler.ml @@ -711,7 +711,7 @@ end = struct let run_and_cleanup t f = let res = run t f in - let opt = + let status_line = match res with | Error Files_changed -> Some @@ -720,7 +720,7 @@ end = struct (Pp.verbatim ", killing current build...")) | _ -> None in - Console.Status_line.set (Fun.const opt); + Console.Status_line.set (Fun.const status_line); match kill_and_wait_for_all_processes t () with | Got_signal -> Error Got_signal | Ok -> res From 43fa0b17e27d12958a26ce85082e9657253b6467 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Mon, 21 Sep 2020 10:49:39 +0100 Subject: [PATCH 5/6] changelog Signed-off-by: Jeremie Dimino --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b79e13de61c..1e14c490203 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -18,6 +18,9 @@ Unreleased - Add (enabled_if ...) to (copy_files ...) (#3756, @nojb) +- Make sure Dune cleans up the status line before exiting (#3767, + fixes #3737, @dosaylazy) + 2.7.1 (2/09/2020) ----------------- From ceb8952fe361e56596bf3c4da3769e5b2b8ce03c Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Mon, 21 Sep 2020 10:55:16 +0100 Subject: [PATCH 6/6] Fix bootstrap as well Signed-off-by: Jeremie Dimino --- bootstrap.ml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/bootstrap.ml b/bootstrap.ml index e36edd33cb8..39eda17aec0 100644 --- a/bootstrap.ml +++ b/bootstrap.ml @@ -4,7 +4,7 @@ open Printf (* This program performs version checking of the compiler and switches to the secondary compiler if necessary. The script should execute in OCaml 4.02! *) -let min_supported_natively = (4, 08) +let min_supported_natively = (4, 08, 0) let verbose, keep_generated_files, debug = let anon s = raise (Arg.Bad (sprintf "don't know what to do with %s\n" s)) in @@ -65,7 +65,7 @@ let read_file fn = s let () = - let v = Scanf.sscanf Sys.ocaml_version "%d.%d" (fun a b -> (a, b)) in + let v = Scanf.sscanf Sys.ocaml_version "%d.%d.%d" (fun a b c -> (a, b, c)) in let compiler, which = if v >= min_supported_natively then ("ocamlc", None) @@ -77,15 +77,15 @@ let () = prerr_endline s; if n <> 0 || s <> "" then ( Format.eprintf "@[%a@]@." Format.pp_print_text - (sprintf + (let a, b, _ = min_supported_natively in + sprintf "The ocamlfind's secondary toolchain does not seem to be \ correctly installed.\n\ Dune requires OCaml %d.%02d or later to compile.\n\ Please either upgrade your compile or configure a secondary \ OCaml compiler (in opam, this can be done by installing the \ ocamlfind-secondary package)." - (fst min_supported_natively) - (snd min_supported_natively)); + a b); exit 2 ); (compiler, Some "--secondary") @@ -94,7 +94,7 @@ let () = (runf "%s %s -w -24 -g -o %s -I boot unix.cma %s" compiler (* Make sure to produce a self-contained binary as dlls tend to cause issues *) - ( if v < (4, 10) then + ( if v < (4, 10, 1) then "-custom" else "-output-complete-exe" )