Skip to content

Commit

Permalink
load Pkg if not to reinstate missing package add prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Nov 11, 2023
1 parent 16e61e2 commit 1034438
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions stdlib/REPL/src/REPL.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ function eval_user_input(@nospecialize(ast), backend::REPLBackend, mod::Module)
put!(backend.response_channel, Pair{Any, Bool}(lasterr, true))
else
backend.in_eval = true
isempty(install_packages_hooks) && load_pkg()
if !isempty(install_packages_hooks)
check_for_missing_packages_and_run_hooks(ast)
end
Expand Down Expand Up @@ -1595,6 +1596,14 @@ function __current_ast_transforms(backend)
end
end

function load_pkg()
pkgid = Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg")
if Base.locate_package(pkgid) !== nothing # Only try load Pkg if we can find it
Pkg = Base.require(pkgid)
return Pkg
end
return nothing
end

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

0 comments on commit 1034438

Please sign in to comment.