From d6c539914e31de73ebae28fde9901ed48ecfd1e7 Mon Sep 17 00:00:00 2001 From: Ian Butterworth Date: Mon, 31 May 2021 15:39:27 +0200 Subject: [PATCH] Precompile: Improve handling of packages that are missing modules (#2579) (cherry picked from commit 510453668c157b7629f26b15f111b590491c1559) --- src/API.jl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/API.jl b/src/API.jl index f022315b75..41a94f48fb 100644 --- a/src/API.jl +++ b/src/API.jl @@ -1012,6 +1012,7 @@ function precompile(ctx::Context; internal_call::Bool=false, strict::Bool=false, function handle_interrupt(err) notify(interrupted_or_done) + sleep(0.2) # yield for a period to let the print loop cease first if err isa InterruptException lock(print_lock) do println(io, " Interrupted: Exiting precompilation...") @@ -1162,8 +1163,8 @@ function precompile(ctx::Context; internal_call::Bool=false, strict::Bool=false, end loaded && (n_loaded += 1) catch err - if err isa ErrorException - failed_deps[pkg] = (strict || is_direct_dep) ? String(take!(iob)) : "" + if err isa ErrorException || (err isa ArgumentError && startswith(err.msg, "Invalid header in cache file")) + failed_deps[pkg] = (strict || is_direct_dep) ? string(sprint(showerror, err), "\n", String(take!(iob))) : "" !fancyprint && lock(print_lock) do println(io, string(color_string(" ✗ ", Base.error_color()), name)) end