Skip to content

Commit 0d029ea

Browse files
Load Pkg if not already to reinstate missing package add prompt (#52125)
1 parent 6f8ba49 commit 0d029ea

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
@@ -222,9 +222,7 @@ function eval_user_input(@nospecialize(ast), backend::REPLBackend, mod::Module)
222222
put!(backend.response_channel, Pair{Any, Bool}(lasterr, true))
223223
else
224224
backend.in_eval = true
225-
if !isempty(install_packages_hooks)
226-
check_for_missing_packages_and_run_hooks(ast)
227-
end
225+
check_for_missing_packages_and_run_hooks(ast)
228226
for xf in backend.ast_transforms
229227
ast = Base.invokelatest(xf, ast)
230228
end
@@ -251,6 +249,7 @@ function check_for_missing_packages_and_run_hooks(ast)
251249
mods = modules_to_be_loaded(ast)
252250
filter!(mod -> isnothing(Base.identify_package(String(mod))), mods) # keep missing modules
253251
if !isempty(mods)
252+
isempty(install_packages_hooks) && Base.require_stdlib(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
254253
for f in install_packages_hooks
255254
Base.invokelatest(f, mods) && return
256255
end
@@ -1658,7 +1657,6 @@ function __current_ast_transforms(backend)
16581657
end
16591658
end
16601659

1661-
16621660
function numbered_prompt!(repl::LineEditREPL=Base.active_repl, backend=nothing)
16631661
n = Ref{Int}(0)
16641662
set_prompt(repl, n)

0 commit comments

Comments
 (0)