Fall back to open/write when atomic_write fails
Fixes Homebrew/homebrew#28190.
This commit is contained in:
parent
d8bdcf84af
commit
f7f200591c
@ -45,10 +45,15 @@ class Keg < Pathname
|
||||
changed = s.gsub!(old_cellar, new_cellar)
|
||||
changed = s.gsub!(old_prefix, new_prefix) || changed
|
||||
|
||||
if changed
|
||||
begin
|
||||
first.atomic_write(s)
|
||||
rest.each { |file| FileUtils.ln(first, file, :force => true) }
|
||||
rescue Errno::EACCES
|
||||
first.ensure_writable do
|
||||
first.open("wb") { |f| f.write(s) }
|
||||
end
|
||||
else
|
||||
rest.each { |file| FileUtils.ln(first, file, :force => true) }
|
||||
end if changed
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user