Replace files atomically when relocating

This commit is contained in:
Jack Nagel 2014-03-26 16:07:49 -05:00
parent 976bf3f60b
commit 91d31ae1f4

View File

@ -40,13 +40,10 @@ class Keg
(pkgconfig_files | libtool_files | script_files).each do |file|
file.ensure_writable do
file.open('rb') do |f|
s = f.read
s.gsub!(old_cellar, new_cellar)
s.gsub!(old_prefix, new_prefix)
f.reopen(file, 'wb')
f.write(s)
end
s = file.open("rb", &:read)
s.gsub!(old_cellar, new_cellar)
s.gsub!(old_prefix, new_prefix)
file.atomic_write(s)
end
end
end