Skip to content

When require in .irbrc fails with LoadError, error message will be suppressed #579

@tompng

Description

@tompng

Description

If you write require 'something' in irbrc and it fails loading, IRB does not show error message.
I will be hard to know the reason why irbrc is not loaded.

Reproduce

With this .irbrc file

puts 'irbrc_loading'
require 'matrix'
puts 'foobarbaz'
foo.bar.baz

Normally, error in irbrc will be displayed.

[tomoya:irbrctest]% irb
irbrc_loading
foobarbaz
load error: /Users/tomoya/Desktop/irbrctest/.irbrc
NameError: undefined local variable or method `foo' for main:Object
	/Users/tomoya/Desktop/irbrctest/.irbrc:4:in `<top (required)>'
	/Users/tomoya/Documents/github/ruby/irb/lib/irb/init.rb:360:in `load'
	/Users/tomoya/Documents/github/ruby/irb/lib/irb/init.rb:360:in `run_config'
	/Users/tomoya/Documents/github/ruby/irb/lib/irb/init.rb:14:in `setup'
irb(main):001:0> 

But LoadError is suppressed (with empty Gemfile and bundle exec, require 'matrix' fails)

[tomoya:irbrctest]% cat Gemfile
# empty
[tomoya:irbrctest]% bundle exec irb
irbrc_loading
irb(main):001:0> 

Result of irb_info

irb(main):001:0> irb_info
=> 
Ruby version: 3.2.0
IRB version: irb 1.6.4 (2023-04-07)
InputMethod: RelineInputMethod with Reline 0.3.3 and /Users/tomoya/.inputrc
.irbrc path: /Users/tomoya/Desktop/irbrctest/.irbrc
RUBY_PLATFORM: x86_64-darwin20
LANG env: ja_JP.UTF-8
East Asian Ambiguous Width: 1

Terminal Emulator

macOS Terminal.app

Setting Files

Are you using ~/.irbrc and ~/.inputrc?
Using .irbrc. contents are written above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions