Process#spawn should call #to_io on non-IO file descriptor objects #2809
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.