ruby.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
If you are interested in the Ruby programming language, come join us! Tell us about yourself when signing up. If you just want to join Mastodon, another server will be a better place for you.

Administered by:

Server stats:

1.1K
active users

Tom Stuart

Why can’t I set `--backtrace-limit` in `RUBYOPT`? Is there another way to configure a default backtrace limit? Am I losing my grip on reality?

```
% ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0)

% ruby --backtrace-limit=1 -e 'def f = f; f'
-e:1:in `f': stack level too deep (SystemStackError)
from -e:1:in `f'
... 10919 levels...

% export RUBYOPT='--backtrace-limit=1'

% ruby -e 'def f = f; f'
ruby: invalid switch in RUBYOPT: --backtrace-limit (RuntimeError)
```

@tom I think I’ve had a similar problem before - RUBYOPT is limited in what it supports (the Ruby man page lists what it does). If there’s no other way to set it and you want an ENV var, your only option short of patching Ruby is to write a wrapper script.

@zetter Groan, thanks, you’re right. I had no idea `RUBYOPT` only supported a subset of the command line options. 😢