-
Notifications
You must be signed in to change notification settings - Fork 186
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
Process#spawn should call #to_io on non-IO file descriptor objects #2809
Conversation
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
I have submitted my Oracle's Contributor Agreement Application and it is being reviewed. |
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.
Thank you for the PR!
I'll rework a bit the specs to use a mock and just use the last example as that covers everything and avoids extra subprocesses (which is rather slow).
* Avoid `should_not raise_error` * Use mock() instead of manually doing it
Thank you, Benoit! |
When an object is passed as the value to a
Process#spawn
redirection option AND that object isn't a Symbol, Array, Integer, or an IO object AND that object responds to#to_io
, thenProcess#spawn
should call#to_io
on that object to get the file descriptor.In TruffleRuby 22.3.0 and head,
Process#spawn
raises an error in this situation without calling the object's#to_io
method.The MRI implementation has done this since 2.0.0 and JRuby has done this since 9.4.0.0. I have created the project jcouball/convert_to_fd_test to illustrate this. The project contains RSpec tests that test this scenario and uses Github Actions to run these tests on different versions of MRI, JRuby, and TruffleRuby. The results of running these tests on different Rubies can be found here.
I am not able to run the spec in Windows and an hoping those are exercised via the CI build.