Skip to content

Commit fcadc06

Browse files
IanButterworthKristofferC
authored andcommitted
Load Pkg if not already to reinstate missing package add prompt (#52125)
(cherry picked from commit 0d029ea)
1 parent e6e8a1d commit fcadc06

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

stdlib/REPL/src/REPL.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,7 @@ function eval_user_input(@nospecialize(ast), backend::REPLBackend, mod::Module)
215215
put!(backend.response_channel, Pair{Any, Bool}(lasterr, true))
216216
else
217217
backend.in_eval = true
218-
if !isempty(install_packages_hooks)
219-
check_for_missing_packages_and_run_hooks(ast)
220-
end
218+
check_for_missing_packages_and_run_hooks(ast)
221219
for xf in backend.ast_transforms
222220
ast = Base.invokelatest(xf, ast)
223221
end
@@ -244,6 +242,7 @@ function check_for_missing_packages_and_run_hooks(ast)
244242
mods = modules_to_be_loaded(ast)
245243
filter!(mod -> isnothing(Base.identify_package(String(mod))), mods) # keep missing modules
246244
if !isempty(mods)
245+
isempty(install_packages_hooks) && Base.require_stdlib(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
247246
for f in install_packages_hooks
248247
Base.invokelatest(f, mods) && return
249248
end
@@ -1651,7 +1650,6 @@ function __current_ast_transforms(backend)
16511650
end
16521651
end
16531652

1654-
16551653
function numbered_prompt!(repl::LineEditREPL=Base.active_repl, backend=nothing)
16561654
n = Ref{Int}(0)
16571655
set_prompt(repl, n)

0 commit comments

Comments
 (0)