Skip to content

Commit

Permalink
Fix for saving logic and test
Browse files Browse the repository at this point in the history
  • Loading branch information
BioTurboNick committed Sep 24, 2021
1 parent 8ea90c8 commit ba65a19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,17 @@ function display_error(io::IO, er, bt)
printstyled(io, "ERROR: "; bold=true, color=Base.error_color())
bt = scrub_repl_backtrace(bt)
stack = ExceptionStack([(exception = er, backtrace = bt)])
istrivial = length(stack) == 1 && length(bt) 1 # frame 1 = top level
istrivial = length(bt) 1 # frame 1 = top level
!istrivial && ccall(:jl_set_global, Cvoid, (Any, Any, Any), Main, :err, stack)
showerror(IOContext(io, :limit => true), er, bt, backtrace = bt!==nothing)
println(io)
end
function display_error(io::IO, stack::ExceptionStack)
printstyled(io, "ERROR: "; bold=true, color=Base.error_color())
bt = Any[ (x[1], scrub_repl_backtrace(x[2])) for x in stack ]
stack = ExceptionStack([(exception = x[1], backtrace = scrub_repl_backtrace(x[2])) for x in stack ])
istrivial = length(stack) == 1 && length(stack[1].backtrace) 1 # frame 1 = top level
!istrivial && ccall(:jl_set_global, Cvoid, (Any, Any, Any), Main, :err, stack)
show_exception_stack(IOContext(io, :limit => true), bt)
show_exception_stack(IOContext(io, :limit => true), stack)
println(io)
end
display_error(stack::ExceptionStack) = display_error(stderr, stack)
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 @@ -1382,6 +1382,8 @@ fake_repl() do stdin_write, stdout_read, repl
@test readline(stdout_read) == "\e[0mERROR: UndefVarError: err not defined"
readuntil(stdout_read, "julia> ", keep=true)
write(stdin_write, "foo() = foobar\n")
readline(stdout_read)
readuntil(stdout_read, "julia> ", keep=true)
write(stdin_write, "foo()\n")
readline(stdout_read)
@test readline(stdout_read) == "\e[0m1-element ExceptionStack:"
Expand Down

0 comments on commit ba65a19

Please sign in to comment.