Skip to content
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

Weak guarantees for IO#write override #434

Open
itarato opened this issue Jun 2, 2023 · 0 comments
Open

Weak guarantees for IO#write override #434

itarato opened this issue Jun 2, 2023 · 0 comments

Comments

@itarato
Copy link

itarato commented Jun 2, 2023

During CI bug investigation we noticed this code:

def activate(stream, streamname)
writer = StdoutRouter::Writer.new(stream, streamname)
raise if stream.respond_to?(WRITE_WITHOUT_CLI_UI)
stream.singleton_class.send(:alias_method, WRITE_WITHOUT_CLI_UI, :write)
stream.define_singleton_method(:write) do |*args|
writer.write(*args)
end
overriding IO#write for STDOUT and STDERR. This is quietly disabled by any call on IO#reopen, for example: a test calling #capture from https://github.com/rails/rails/blob/0e99d0893b0e98c626a3c7d8972eea22d29c9d25/activesupport/lib/active_support/testing/stream.rb#L23-L38

If the goal of the cli-ui code to be permanent, it needs adjustments. This is true for CRuby and TruffleRuby engines.

More details: oracle/truffleruby#3088

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

No branches or pull requests

1 participant