Skip to content

Commit 86b63d5

Browse files
authored
Merge pull request #9581 from ruby/atomic-write-vendored-compact-index
Write vendored compact_index files atomically
2 parents 0365a17 + a2f265f commit 86b63d5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

spec/support/rubygems_ext.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ def install_vendored_compact_index
110110
url = "https://raw.githubusercontent.com/rubygems/rubygems.org/#{ref}/#{path}"
111111
target = target_root.join(path)
112112
FileUtils.mkdir_p(File.dirname(target))
113-
File.write(target, URI.parse(url).open(&:read))
113+
tmp = "#{target}.tmp"
114+
File.write(tmp, URI.parse(url).open(&:read))
115+
File.rename(tmp, target)
114116
end
115117
end
116118
end

0 commit comments

Comments
 (0)