-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support JRuby #3
Conversation
This adds JRuby's logic used on platforms where we do not have native access to posix_spawn and related posix functions needed to do fully-native subprocess launching and management. The code here instead uses the JDK ProcessBuilder logic to simulate most of the Open3 functionality. This code does not pass all tests, currently, but provides most of the key functionality on pure-Java (i.e. no native FFI) platforms.
@hsbt This is mergeable now, but there are some open questions:
Once this is released as a gem, JRuby will be able to eliminate its local copy of open3 and use the gem instead. |
Co-authored-by: Olle Jonsson <olle.jonsson@gmail.com>
This allows the wrapper functions in the main open3 to be defined while using our ProcessBuilder logic for the internal popen implementation. Note this adds logic to reject redirects from a numeric fd to a live IO object (or not a String or to_path object) since we cannot support direct IO redirects with ProcesBuilder. This patch allows tests to complete with the ProcessBuilder impl. Only three tests fail: * test_numeric_file_descriptor2 and test_numeric_file_descriptor2 fail due to redirecting streams to a pipe IO. * test_pid fails expecting a real PID which we cannot provide via ProcessBuilder.
RUBY_PLATFORM on JRuby is always 'java' so it does not indicate the host OS.
This is now complete. I did an additional pass to update and improve the JDK logic from JRuby 9.4, which now errors out for unsupported redirects and reuses the wrapper functions from open3.rb. The JDK version passes all but three tests:
JRuby's CI runs could add Windows, but these tests would need to be masked out. Let me know what more I need to do to get this released! |
Tweaks and additions to support JRuby.