Skip to content

Commit 1034438

Browse files
load Pkg if not to reinstate missing package add prompt
1 parent 16e61e2 commit 1034438

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stdlib/REPL/src/REPL.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ function eval_user_input(@nospecialize(ast), backend::REPLBackend, mod::Module)
158158
put!(backend.response_channel, Pair{Any, Bool}(lasterr, true))
159159
else
160160
backend.in_eval = true
161+
isempty(install_packages_hooks) && load_pkg()
161162
if !isempty(install_packages_hooks)
162163
check_for_missing_packages_and_run_hooks(ast)
163164
end
@@ -1595,6 +1596,14 @@ function __current_ast_transforms(backend)
15951596
end
15961597
end
15971598

1599+
function load_pkg()
1600+
pkgid = Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg")
1601+
if Base.locate_package(pkgid) !== nothing # Only try load Pkg if we can find it
1602+
Pkg = Base.require(pkgid)
1603+
return Pkg
1604+
end
1605+
return nothing
1606+
end
15981607

15991608
function numbered_prompt!(repl::LineEditREPL=Base.active_repl, backend=nothing)
16001609
n = Ref{Int}(0)

0 commit comments

Comments
 (0)