Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions base/precompilation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -350,8 +350,8 @@ function show_progress(io::IO, p::MiniProgressBar; termwidth=nothing, carriagere
end
termwidth = @something termwidth (displaysize(io)::Tuple{Int,Int})[2]
max_progress_width = max(0, min(termwidth - textwidth(p.header) - textwidth(progress_text) - 10 , p.width))
n_filled = floor(Int, max_progress_width * perc / 100)
partial_filled = (max_progress_width * perc / 100) - n_filled
filled = max_progress_width * clamp(perc / 100, 0.0, 1.0)
(partial_filled, n_filled::Int64) = modf(filled) # get fractional / integer part
n_left = max_progress_width - n_filled
headers = split(p.header, ' ')
to_print = sprint(; context=io) do io
Expand Down Expand Up @@ -998,8 +998,11 @@ function _precompilepkgs(pkgs::Union{Vector{String}, Vector{PkgId}},
if i_local > 1
print(iostr, ansi_cleartoend)
end
bar.current = n_done[] - n_already_precomp[]
bar.max = n_total - n_already_precomp[]
# max(0,...) guards against a race where the print loop runs after
# n_already_precomp is incremented but before n_done is incremented,
# which would otherwise produce a negative value and crash repeat().
bar.current = max(0, n_done[] - n_already_precomp[])
bar.max = max(0, n_total - n_already_precomp[])
# when sizing to the terminal width subtract a little to give some tolerance to resizing the
# window between print cycles
termwidth = (displaysize(io)::Tuple{Int,Int})[2] - 4
Expand Down
Loading