Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →
instance method
MakeMakefile#create_tmpsrc
create_tmpsrc(src) { |src| ... }
lib/mkmf.rb
View on GitHub ↗
# File tmp/rubies/ruby-3.4.1/lib/mkmf.rb, line 495
def create_tmpsrc(src)
src = "#{COMMON_HEADERS}\n#{src}"
src = yield(src) if block_given?
src.gsub!(/[ \t]+$/, '')
src.gsub!(/\A\n+|^\n+$/, '')
src.sub!(/[^\n]\z/, "\\&\n")
count = 0
begin
File.open(conftest_source, "wb") do |cfile|
cfile.print src
end
rescue Errno::EACCES
if (count += 1) < 5
sleep 0.2
retry
end
end
src
end
Creats temporary source file from COMMON_HEADERS and src. Yields the created source string and uses the returned string as the source code, if the block is given.