-
-
Couldn't load subscription status.
- Fork 5.7k
Closed
Labels
REPLJulia's REPL (Read Eval Print Loop)Julia's REPL (Read Eval Print Loop)bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior
Description
The output prefix logic in display(::REPLDisplay) assumes that the REPL is in normal mode, not in history mode.
This means that code like the following will fail
julia> @async begin
try
sleep(2)
display(Base.Multimedia.displays[2], 2) # Base.Multimedia.displays[2] is the REPLDisplay for me
catch err
@error "cant display" ex=(err, catch_backtrace())
end
end
Task (runnable) @0x00007f0ed7f08fb0
julia> 1+1┌ Error: cant display
│ ex =
│ MethodError: no method matching write_output_prefix(::IOContext{Base.TTY}, ::REPL.LineEdit.PrefixHistoryPrompt, ::Bool)
│
│ Closest candidates are:
│ write_output_prefix(::IO, ::REPL.LineEdit.Prompt, ::Bool)
│ @ REPL ~/.julia/juliaup/julia-1.9.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.9/REPL/src/LineEdit.jl:1472
│
│ Stacktrace:
│ [1] (::REPL.var"#55#56"{REPL.REPLDisplay{REPL.LineEditREPL}, MIME{Symbol("text/plain")}, Base.RefValue{Any}})(io::Any)
│ @ REPL ~/.julia/juliaup/julia-1.9.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.9/REPL/src/REPL.jl:267
│ [2] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
│ @ REPL ~/.julia/juliaup/julia-1.9.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.9/REPL/src/REPL.jl:555
│ [3] display(d::REPL.REPLDisplay, mime::MIME{Symbol("text/plain")}, x::Any)
│ @ REPL ~/.julia/juliaup/julia-1.9.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.9/REPL/src/REPL.jl:262
│ [4] display
│ @ ~/.julia/juliaup/julia-1.9.0-rc1+0.x64.linux.gnu/share/julia/stdlib/v1.9/REPL/src/REPL.jl:279 [inlined]
│ [5] macro expansion
│ @ ./REPL[4]:4 [inlined]
│ [6] (::var"#5#6")()
│ @ Main ./task.jl:514
└ @ Main REPL[4]:6
when moving back in the REPL history after starting the async task. Here's an asciinema recording for illustration purposes.
Metadata
Metadata
Assignees
Labels
REPLJulia's REPL (Read Eval Print Loop)Julia's REPL (Read Eval Print Loop)bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behavior