Skip to content

Commit

Permalink
Fix UndefVarError due to unintentional signature change (JuliaLang#43173
Browse files Browse the repository at this point in the history
)

* Fix UndefVarError due to unintentional signature change

* Add wait for REPL task to exit

* Add test

* test fix

* no invoke
  • Loading branch information
BioTurboNick authored and LilithHafner committed Feb 22, 2022
1 parent d44922b commit 05d62b2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ end
display_error(stack::ExceptionStack) = display_error(stderr, stack)

# these forms are depended on by packages outside Julia
function display_error(io::IO, exception, backtrace)
function display_error(io::IO, er, bt)
printstyled(io, "ERROR: "; bold=true, color=Base.error_color())
showerror(IOContext(io, :limit => true), er, bt, backtrace = bt!==nothing)
println(io)
Expand Down
2 changes: 2 additions & 0 deletions stdlib/REPL/test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1402,4 +1402,6 @@ fake_repl() do stdin_write, stdout_read, repl
@test readline(stdout_read) == "\e[0m1-element ExceptionStack:"
@test readline(stdout_read) == "UndefVarError: foobar not defined"
@test readline(stdout_read) == "Stacktrace:"
write(stdin_write, '\x04')
Base.wait(repltask)
end
9 changes: 9 additions & 0 deletions test/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ end
err_str = String(take!(errio))
@test occursin(nested_error_pattern, err_str)
end

@testset "display_error(io, er, bt) works" begin
errio = IOBuffer()
Base.display_error(errio, ErrorException, [])
err_str = String(take!(errio))
@test occursin(r"""
ERROR: ErrorException
"""s, err_str)
end

0 comments on commit 05d62b2

Please sign in to comment.