Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
Gem.open_file_with_lock
open_file_with_lock(path, &block)
lib/rubygems.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.1.0-preview1/lib/rubygems.rb, line 873
def self.open_file_with_lock(path, &block)
file_lock = "#{path}.lock"
open_file_with_flock(file_lock, &block)
ensure
require "fileutils"
FileUtils.rm_f file_lock
end
Open a file with given flags, and protect access with a file lock