Skip to content

Commit bd0f525

Browse files
committed
Merge pull request #9581 from ruby/atomic-write-vendored-compact-index
Write vendored compact_index files atomically (cherry picked from commit 86b63d5)
1 parent 18fbb14 commit bd0f525

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

bundler/spec/support/rubygems_ext.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ def install_vendored_compact_index
9999
url = "https://raw.githubusercontent.com/rubygems/rubygems.org/#{ref}/#{path}"
100100
target = target_root.join(path)
101101
FileUtils.mkdir_p(File.dirname(target))
102-
File.write(target, URI.parse(url).open(&:read))
102+
tmp = "#{target}.tmp"
103+
File.write(tmp, URI.parse(url).open(&:read))
104+
File.rename(tmp, target)
103105
end
104106
end
105107
end

0 commit comments

Comments
 (0)