-
Notifications
You must be signed in to change notification settings - Fork 79
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
Rewrite unix fork reopen to be compatible with ruby 2.6 #149
Conversation
On ruby 2.6 the original code would fail specs: lib/childprocess/unix/fork_exec_process.rb:32:in `reopen': exclusive access mode is not supported (ArgumentError) The documentation for reopen shows that it has two ways to call it: reopen(other_IO) -> ios reopen(path, mode [,opt]) -> ios With ruby 2.4 and 2.5 calling reopen with a path and no mode seems to work fine, but with ruby 2.6 this triggers the spec failure. This commit splits the calls based on stdout/stderr availability so that both types of reopen calls can get the required parameters. This fixes the 2.6 specs while being backward compatible with ruby 2.4 and 2.5.
enkessler/childprocess#149 Signed-off-by: Hans de Graaff <[email protected]> Package-Manager: Portage-2.3.62, Repoman-2.3.11
3 similar comments
Thanks for the fix, @graaff. Can we add Ruby 2.6 to the Travis and AppVeyor CI matrices so we can confirm your fix results in a passing build? The one failure on AppVeyor looks spurious—I've seen it before. |
I wanted to do that in a separate commit but forgot to include that yet. You can verify already with ruby-head which now passes (checked on travis), but I'll update the pull request. |
Amazing, thank you @graaff! |
Thanks for the quick response and the merge. |
Update ruby-childprocessto 3.0.0. ### Version 3.0.0 / 2019-09-20 * [#156](enkessler/childprocess#156 unused `rubyforge_project` from gemspec * [#160](enkessler/childprocess#160): Remove extension to conditionally install `ffi` gem on Windows platforms * [#160](enkessler/childprocess#160): Remove runtime dependency on `rake` gem ### Version 2.0.0 / 2019-07-11 * [#148](enkessler/childprocess#148): Drop support for Ruby 2.0, 2.1, and 2.2 * [#149](enkessler/childprocess#149): Fix Unix fork reopen to be compatible with Ruby 2.6 * [#152](https://github.com/enkessler/childprocess/pull/152)/[#154](https://github.com/enkessler/childprocess/pull/154): Fix hangs and permission errors introduced in Ruby 2.6 for leader processes of process groups ### Version 1.0.1 / 2019-02-03 * [#143](enkessler/childprocess#144): Fix installs by adding `rake` gem as runtime dependency * [#147](enkessler/childprocess#147): Relax `rake` gem constraint from `< 12` to `< 13` ### Version 1.0.0 / 2019-01-28 * [#134](enkessler/childprocess#134): Add support for non-ASCII characters on Windows * [#132](enkessler/childprocess#132): Install `ffi` gem requirement on Windows only * [#128](enkessler/childprocess#128): Convert environment variable values to strings when `posix_spawn` enabled * [#141](enkessler/childprocess#141): Support JRuby on Java >= 9
On ruby 2.6 the original code would fail specs:
lib/childprocess/unix/fork_exec_process.rb:32:in `reopen': exclusive
access mode is not supported (ArgumentError)
The documentation for reopen shows that it has two ways to call it:
reopen(other_IO) -> ios
reopen(path, mode [,opt]) -> ios
With ruby 2.4 and 2.5 calling reopen with a path and no mode seems to
work fine, but with ruby 2.6 this triggers the spec failure.
This commit splits the calls based on stdout/stderr availability so
that both types of reopen calls can get the required parameters. This
fixes the 2.6 specs while being backward compatible with ruby 2.4 and
2.5.