Skip to content

Commit 1b0e334

Browse files
nsajkoKristofferC
authored andcommitted
_precompilepkgs: interactive progress display: fix unintended capture (#57932)
The variable `str` also exists in one of the enclosing closures. Use a new variable, as was surely intended, instead of capturing and mutating the `str`. Improves the sysimage's resistance to invalidation. (cherry picked from commit fcf492d)
1 parent 0fb76e8 commit 1b0e334

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

base/precompilation.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -835,8 +835,8 @@ function _precompilepkgs(pkgs::Vector{String},
835835
# window between print cycles
836836
termwidth = displaysize(io)[2] - 4
837837
if !final_loop
838-
str = sprint(io -> show_progress(io, bar; termwidth, carriagereturn=false); context=io)
839-
print(iostr, Base._truncate_at_width_or_chars(true, str, termwidth), "\n")
838+
s = sprint(io -> show_progress(io, bar; termwidth, carriagereturn=false); context=io)
839+
print(iostr, Base._truncate_at_width_or_chars(true, s, termwidth), "\n")
840840
end
841841
for pkg_config in pkg_queue_show
842842
dep, config = pkg_config

0 commit comments

Comments
 (0)