diff --git a/eval_error.c b/eval_error.c index 6132cbe8c8..17c0e865b9 100644 --- a/eval_error.c +++ b/eval_error.c @@ -144,8 +144,6 @@ print_errinfo(const VALUE eclass, const VALUE errat, const VALUE emesg, const VA write_warn(str, ": "); } - if (highlight) write_warn(str, bold); - if (!NIL_P(emesg)) { einfo = RSTRING_PTR(emesg); elen = RSTRING_LEN(emesg); diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index c69d18b0c9..713a59df70 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1407,6 +1407,9 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| message = e.full_message(highlight: true) assert_match(/\e/, message) + assert_not_match(/(\e\[1)m\1/, message) + e2 = assert_raise(RuntimeError) {raise RuntimeError, "", bt} + assert_not_match(/(\e\[1)m\1/, e2.full_message(highlight: true)) message = e.full_message if Exception.to_tty?