diff --git a/base/client.jl b/base/client.jl index 04abae8efd0ac..268a24d692373 100644 --- a/base/client.jl +++ b/base/client.jl @@ -414,7 +414,8 @@ function _start() end end catch err - display_error(err,catch_backtrace()) + eval(Main, Expr(:body, Expr(:return, Expr(:call, Base.display_error, + QuoteNode(err), catch_backtrace())))) exit(1) end if is_interactive && have_color diff --git a/test/spawn.jl b/test/spawn.jl index fa8fa030f830f..8b7582b191ad0 100644 --- a/test/spawn.jl +++ b/test/spawn.jl @@ -458,3 +458,11 @@ end # readlines(::Cmd), accidentally broken in #20203 @test sort(readlines(`$lscmd -A`)) == sort(readdir()) + +# issue #19864 (PR #20497) +@test readchomp(pipeline(ignorestatus( + `$exename --startup-file=no -e ' + struct Error19864 <: Exception; end + Base.showerror(io::IO, e::Error19864) = print(io, "correct19864") + throw(Error19864())'`), + stderr=catcmd)) == "ERROR: correct19864"