Skip to content

Fix missing OStream#closed? method #368

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 28, 2025
Merged

Conversation

RobinDaugherty
Copy link
Contributor

@RobinDaugherty RobinDaugherty commented Feb 27, 2025

Currently with Ruby 3.4.1 and bundler 2.6.2, when requireing a Rails application, I get the following error:

require 'path_to_application/config/application'
NoMethodError: undefined method 'closed?' for an instance of IRuby::OStream
[/opt/rbenv/versions/3.4.1/lib/ruby/3.4.0/bundler/ui/shell.rb:145](http://localhost:8888/opt/rbenv/versions/3.4.1/lib/ruby/3.4.0/bundler/ui/shell.rb#line=144):in 'Bundler::UI::Shell#tell_err'
[/opt/rbenv/versions/3.4.1/lib/ruby/3.4.0/bundler/ui/shell.rb:49](http://localhost:8888/opt/rbenv/versions/3.4.1/lib/ruby/3.4.0/bundler/ui/shell.rb#line=48):in 'Bundler::UI::Shell#error'
[/opt/rbenv/versions/3.4.1/lib/ruby/3.4.0/bundler/setup.rb:18](http://localhost:8888/opt/rbenv/versions/3.4.1/lib/ruby/3.4.0/bundler/setup.rb#line=17):in '<top (required)>'

Bundler is calling closed? on stderr https://github.com/rubygems/rubygems/blob/v3.6.2/bundler/lib/bundler/ui/shell.rb#L145

stderr is an instance of IRuby::OStream

Ruby's IO implements the closed? method: https://docs.ruby-lang.org/en/master/IO.html#method-i-closed-3F

The fix for this is to implement the closed? method. With this implementation in place, Bundler is able to run its setup.

@sealocal
Copy link
Contributor

Looks good to me! Thanks for providing references. It appears this only happens when Bundler is trying to report an error, so it was difficult to repro. Thanks for solving it as a number of others have run into the issue.

@sealocal sealocal mentioned this pull request Feb 28, 2025
@sealocal
Copy link
Contributor

fixes #349

@sealocal sealocal merged commit 41bd34f into SciRuby:master Feb 28, 2025
9 of 11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants