JuliaLang / julia

The Julia Programming Language
https://julialang.org/
MIT License
45.41k stars 5.45k forks source link

Base.active_repl isn't defined in Julia 1.11+ even with `julia -i` #55376

Open timholy opened 1 month ago

timholy commented 1 month ago

xref https://github.com/timholy/CodeTracking.jl/actions/runs/10239765827/job/28325729062?pr=130

$ julia +beta -i --startup=no -e "using InteractiveUtils, REPL; @async(Base.run_main_repl(true, true, false, true, false)); sleep(2); @show Base.active_repl"
ERROR: UndefVarError: `active_repl` not defined in `Base`
Suggestion: add an appropriate import or assignment. This global was declared but not assigned.
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:42
 [2] macro expansion
   @ show.jl:1237 [inlined]
 [3] top-level scope
   @ none:1@ none:1

The error doesn't happen on Julia 1.10 and earlier.

vtjnash commented 1 month ago

2 seconds might not be long enough? You are relying on an awful lot of unpredictable behavior putting that behind a timer. Maybe you can use an atreplinit to signal an Event right after the global gets assigned?

timholy commented 1 month ago
julia +beta -i --startup=no -e 'using InteractiveUtils, REPL; @async(Base.run_main_repl(true, true, false, true, false)); while !isdefined(Base, :active_repl) sleep(1); end; @show Base.active_repl'

hangs "forever." I don't think it's an amount-of-delay issue.