Skip to content

Commit

Permalink
load Pkg if needed 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 0d0619f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion 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 @@ -1523,6 +1524,15 @@ function run_frontend(repl::StreamREPL, backend::REPLBackendRef)
nothing
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

module Numbered

using ..REPL
Expand Down Expand Up @@ -1595,7 +1605,6 @@ function __current_ast_transforms(backend)
end
end


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

0 comments on commit 0d0619f

Please sign in to comment.