Skip to content
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

Merged
merged 2 commits into from
Apr 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ rvm:
- 2.3
- 2.4
- 2.5
- 2.6
- ruby-head

sudo: false
Expand Down
6 changes: 6 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ environment:
- CHILDPROCESS_POSIX_SPAWN: false
CHILDPROCESS_UNSET: should-be-unset
RUBY_VERSION: 25-x64
- CHILDPROCESS_POSIX_SPAWN: true
CHILDPROCESS_UNSET: should-be-unset
RUBY_VERSION: 26-x64
- CHILDPROCESS_POSIX_SPAWN: false
CHILDPROCESS_UNSET: should-be-unset
RUBY_VERSION: 26-x64

install:
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
Expand Down
12 changes: 10 additions & 2 deletions lib/childprocess/unix/fork_exec_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,16 @@ def launch_process
exec_r.close
set_env

STDOUT.reopen(stdout || "/dev/null")
STDERR.reopen(stderr || "/dev/null")
if stdout
STDOUT.reopen(stdout)
else
STDOUT.reopen("/dev/null", "a+")
end
if stderr
STDERR.reopen(stderr)
else
STDERR.reopen("/dev/null", "a+")
end

if duplex?
STDIN.reopen(reader)
Expand Down