Skip to content

Commit 57940f7

Browse files
wait for repl async to allow for startup.jl loading sequence (#720)
1 parent 92d8b63 commit 57940f7

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/packagedef.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,14 +1317,22 @@ function __init__()
13171317
else
13181318
pushfirst!(REPL.repl_ast_transforms, revise_first)
13191319
# #664: once a REPL is started, it no longer interacts with REPL.repl_ast_transforms
1320-
iter = 0
1321-
# wait for active_repl_backend to exist
1322-
while !isdefined(Base, :active_repl_backend) && iter < 20
1323-
sleep(0.05)
1324-
iter += 1
1325-
end
13261320
if isdefined(Base, :active_repl_backend)
13271321
push!(Base.active_repl_backend.ast_transforms, revise_first)
1322+
else
1323+
# wait for active_repl_backend to exist
1324+
# #719: do this async in case Revise is being loaded from startup.jl
1325+
t = @async begin
1326+
iter = 0
1327+
while !isdefined(Base, :active_repl_backend) && iter < 20
1328+
sleep(0.05)
1329+
iter += 1
1330+
end
1331+
if isdefined(Base, :active_repl_backend)
1332+
push!(Base.active_repl_backend.ast_transforms, revise_first)
1333+
end
1334+
end
1335+
isdefined(Base, :errormonitor) && Base.errormonitor(t)
13281336
end
13291337
end
13301338
if isdefined(Main, :Atom)

0 commit comments

Comments
 (0)