Rewrite unix fork reopen to be compatible with ruby 2.6#149
Merged
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.
zmedico
pushed a commit
to zmedico/gentoo
that referenced
this pull request
Apr 29, 2019
enkessler/childprocess#149 Signed-off-by: Hans de Graaff <graaff@gentoo.org> Package-Manager: Portage-2.3.62, Repoman-2.3.11
3 similar comments
Collaborator
|
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. |
Contributor
Author
|
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. |
Collaborator
|
Amazing, thank you @graaff! |
Contributor
Author
|
Thanks for the quick response and the merge. |
netbsd-srcmastr
pushed a commit
to NetBSD/pkgsrc
that referenced
this pull request
Mar 24, 2020
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
msk
pushed a commit
to msk/pkgsrc
that referenced
this pull request
May 11, 2026
Update ruby-childprocessto 3.0.0. ### Version 3.0.0 / 2019-09-20 * [NetBSD#156](enkessler/childprocess#156 unused `rubyforge_project` from gemspec * [NetBSD#160](enkessler/childprocess#160): Remove extension to conditionally install `ffi` gem on Windows platforms * [NetBSD#160](enkessler/childprocess#160): Remove runtime dependency on `rake` gem ### Version 2.0.0 / 2019-07-11 * [NetBSD#148](enkessler/childprocess#148): Drop support for Ruby 2.0, 2.1, and 2.2 * [NetBSD#149](enkessler/childprocess#149): Fix Unix fork reopen to be compatible with Ruby 2.6 * [NetBSD#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 * [NetBSD#143](enkessler/childprocess#144): Fix installs by adding `rake` gem as runtime dependency * [NetBSD#147](enkessler/childprocess#147): Relax `rake` gem constraint from `< 12` to `< 13` ### Version 1.0.0 / 2019-01-28 * [NetBSD#134](enkessler/childprocess#134): Add support for non-ASCII characters on Windows * [NetBSD#132](enkessler/childprocess#132): Install `ffi` gem requirement on Windows only * [NetBSD#128](enkessler/childprocess#128): Convert environment variable values to strings when `posix_spawn` enabled * [NetBSD#141](enkessler/childprocess#141): Support JRuby on Java >= 9
jperkin
pushed a commit
to TritonDataCenter/pkgsrc
that referenced
this pull request
May 14, 2026
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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.