diff options
author | Yusuke Endoh <[email protected]> | 2022-02-02 15:08:10 +0900 |
---|---|---|
committer | Yusuke Endoh <[email protected]> | 2022-02-22 11:55:40 +0900 |
commit | 98ca99cdd090d17b7ec11e0c6f40936a728165a5 (patch) | |
tree | 257e74ddef4e448410b9d525ddbe0e226616a925 /error.c | |
parent | 35ff545bb689f5af93ac603ea1f512705e0dc249 (diff) |
The default highlight arguments of Exception#detailed_message is false
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5516
Diffstat (limited to 'error.c')
-rw-r--r-- | error.c | 15 |
1 files changed, 10 insertions, 5 deletions
@@ -1263,7 +1263,7 @@ exc_s_to_tty_p(VALUE self) } static VALUE -check_highlight_keyword(VALUE opt) +check_highlight_keyword(VALUE opt, int auto_tty_detect) { VALUE highlight = Qnil; @@ -1283,7 +1283,12 @@ check_highlight_keyword(VALUE opt) } if (NIL_P(highlight)) { - highlight = rb_stderr_tty_p() ? Qtrue : Qfalse; + if (auto_tty_detect) { + highlight = rb_stderr_tty_p() ? Qtrue : Qfalse; + } + else { + highlight = Qfalse; + } } return highlight; @@ -1342,7 +1347,7 @@ exc_full_message(int argc, VALUE *argv, VALUE exc) rb_scan_args(argc, argv, "0:", &opt); - highlight = check_highlight_keyword(opt); + highlight = check_highlight_keyword(opt, 1); order = check_order_keyword(opt); str = rb_str_new2(""); @@ -1392,11 +1397,11 @@ exc_detailed_message(int argc, VALUE *argv, VALUE exc) rb_scan_args(argc, argv, "0:", &opt); - VALUE highlight = check_highlight_keyword(opt); + VALUE highlight = check_highlight_keyword(opt, 0); extern VALUE rb_decorate_message(const VALUE eclass, const VALUE emesg, int highlight); - return rb_decorate_message(CLASS_OF(exc), rb_get_message(exc), highlight); + return rb_decorate_message(CLASS_OF(exc), rb_get_message(exc), RTEST(highlight)); } /* |