Skip to content

Commit

Permalink
Fix multiple print of precompiling project... (#2047)
Browse files Browse the repository at this point in the history
* fix multiple print of `precompiling project...`
  • Loading branch information
IanButterworth authored Sep 30, 2020
1 parent 7003970 commit 9818e43
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,7 @@ function precompile(ctx::Context; internal_call::Bool=false)
was_recompiled[pkgid] = false
end

print_lock = stdout isa Base.LibuvStream ? stdout.lock : ReentrantLock()
errored = false
toml_c = Base.TOMLCache()
@sync for (pkg, deps) in depsmap
Expand Down Expand Up @@ -975,8 +976,12 @@ function precompile(ctx::Context; internal_call::Bool=false)
end
is_direct_dep = pkg in direct_deps
try
!any(values(was_recompiled)) && printpkgstyle(ctx, :Precompiling, "project...")
was_recompiled[pkg] = true
lock(print_lock) do
if !any(values(was_recompiled))
printpkgstyle(ctx, :Precompiling, "project...")
end
was_recompiled[pkg] = true # needs to be in lock to prevent async race on printing
end
Base.compilecache(pkg, sourcepath, toml_c, is_direct_dep) # don't print errors from indirect deps
catch err
Operations.precomp_suspend!(pkg)
Expand Down

0 comments on commit 9818e43

Please sign in to comment.