Skip to content

Commit 2a14dd2

Browse files
Fix startup when history file is bad
1 parent cbea8cf commit 2a14dd2

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

stdlib/REPL/src/REPL.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,14 @@ function setup_interface(
14091409
end
14101410
hist_from_file(hp, hist_path)
14111411
catch
1412+
# During REPL setup, the backend isn't available yet, so we manually call
1413+
# the IO version of print_response with backend=nothing to avoid UndefRefError
14121414
# use REPL.hascolor to avoid using the local variable with the same name
1413-
print_response(repl, Pair{Any, Bool}(current_exceptions(), true), true, REPL.hascolor(repl))
1415+
repl.waserror = true
1416+
with_repl_linfo(repl) do io
1417+
io = IOContext(io, :module => Base.active_module(repl)::Module)
1418+
print_response(io, Pair{Any, Bool}(current_exceptions(), true), nothing, true, REPL.hascolor(repl), specialdisplay(repl))
1419+
end
14141420
println(outstream(repl))
14151421
@info "Disabling history file for this session"
14161422
repl.history_file = false

0 commit comments

Comments
 (0)