Issue #17479 has been updated by Eregon (Benoit Daloze).


What's the use case?
I think we should encourage to use `Exception#full_message`, and that could default to apply the limit.
Related: https://github.com/ruby/ruby/commit/f6a080047e960e8b1821a97850830286ce9dee1c#commitcomment-45451705

----------------------------------------
Feature #17479: Enable to get "--backtrace-limit" value by "$-B"
https://bugs.ruby-lang.org/issues/17479#change-89567

* Author: neg_hide (Hidenori Negishi)
* Status: Open
* Priority: Normal
----------------------------------------
# Background

There is currently no way to get "--backtrace-limit" value when outputing backtraces from my script, so I have to ignore this value and output backtraces.

In order to be able to output according to "--backtrace-limit" value, I need a API to get this value from the Ruby side.

# Proposal

I propose a readonly built-in variable "$-B" to get "--backtrace-limit" value.

``` ruby
# ruby --backtrace-limit=3 script.rb

puts $-B # => 3
```



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>