Skip to content
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
2 changes: 1 addition & 1 deletion ext/zlib/zlib.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ Gem::Specification.new do |spec|
spec.executables = []
spec.require_paths = ["lib"]
spec.extensions = "ext/zlib/extconf.rb"
spec.required_ruby_version = ">= 2.5.0"
spec.required_ruby_version = ">= 2.7.0"
end
46 changes: 25 additions & 21 deletions spec/ruby/core/io/buffer/map_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,30 +73,34 @@ def open_big_file_fixture
@buffer.should.valid?
end

guard -> { Process.respond_to?(:fork) } do
it "is shareable across processes" do
file_name = tmp("shared_buffer")
@file = File.open(file_name, "w+")
@file << "I'm private"
@file.rewind
@buffer = IO::Buffer.map(@file)

IO.popen("-") do |child_pipe|
if child_pipe
# Synchronize on child's output.
child_pipe.readlines.first.chomp.should == @buffer.to_s
@buffer.get_string.should == "I'm shared!"

@file.read.should == "I'm shared!"
else
@buffer.set_string("I'm shared!")
puts @buffer
# IO::Buffer.map seems not shareable across processes on OpenBSD.
# See https://rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20260129T163005Z.fail.html.gz
platform_is_not :openbsd do
guard -> { Process.respond_to?(:fork) } do
it "is shareable across processes" do
file_name = tmp("shared_buffer")
@file = File.open(file_name, "w+")
@file << "I'm private"
@file.rewind
@buffer = IO::Buffer.map(@file)

IO.popen("-") do |child_pipe|
if child_pipe
# Synchronize on child's output.
child_pipe.readlines.first.chomp.should == @buffer.to_s
@buffer.get_string.should == "I'm shared!"

@file.read.should == "I'm shared!"
else
@buffer.set_string("I'm shared!")
puts @buffer
end
ensure
child_pipe&.close
end
ensure
child_pipe&.close
File.unlink(file_name)
end
ensure
File.unlink(file_name)
end
end

Expand Down