-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Prefer IO::NULL over hardcoded device name #18381
Conversation
Maybe all these can be extracted as a single method? |
@@ -939,7 +939,15 @@ def quietly | |||
|
|||
def silence_stream(stream) | |||
old_stream = stream.dup | |||
stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null') | |||
null = case | |||
when IO.const_defined?(:NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On which platforms is IO::NULL not defined?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.9.2 and earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.9.2 hasn't been supported by Rails for a long time. Even for existing 4.2 build, 1.9.3 is minimum.
As for Rails 5.0, it'll have minimum version of either 2.2 or 2.1.
So I think you could just always use IO:NULL
and remove the other conditions. Unless it's an issue on JRuby or Rubinius?
@nobu I merged a rebased version of this PR. Thank you 💛 |
@vipulnsward I agree that it would be nice to extract a method into a common place for all test suites. As far as I know other than |
No description provided.