Skip to content

Commit

Permalink
Remove ostruct dependency (#196)
Browse files Browse the repository at this point in the history
Starting in Ruby 3.4, the following deprecation warning is printed when
running the childprocess specs:

> childprocess/spec/spec_helper.rb:14: warning: ostruct was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.5.0. Add ostruct to your Gemfile or gemspec.

This commit fixes this warning by removing our dependency on the
`ostruct` gem entirely, replacing it with a normal `Struct`.
  • Loading branch information
mattbrictson authored May 30, 2024
1 parent 127a3d1 commit 9c0d345
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
require 'tempfile'
require 'socket'
require 'stringio'
require 'ostruct'

module ChildProcessSpecHelper
RUBY = defined?(Gem) ? Gem.ruby : 'ruby'
CapturedOutput = Struct.new(:stdout, :stderr)

def ruby_process(*args)
@process = ChildProcess.build(RUBY , *args)
Expand Down Expand Up @@ -229,7 +229,7 @@ def capture_std

yield

OpenStruct.new stdout: rewind_and_read(out), stderr: rewind_and_read(err)
CapturedOutput.new rewind_and_read(out), rewind_and_read(err)
ensure
STDOUT.reopen orig_out
STDERR.reopen orig_err
Expand Down

0 comments on commit 9c0d345

Please sign in to comment.