aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-04-05 23:07:28 -0500
committerJack Nagel2014-04-06 00:28:15 -0500
commit6d4882c607987d213e212e8d0fff87136ac7d300 (patch)
treec763b137a694cc78483d9445fc5faea9dbac4380 /Library
parent9a26171eb661ad0d0719e9b101ebf610da8bfaa6 (diff)
downloadhomebrew-6d4882c607987d213e212e8d0fff87136ac7d300.tar.bz2
Fall back to open/write when atomic_write fails
Fixes #28190.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/keg_fix_install_names.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb
index 083afabff..efc1bd48c 100644
--- a/Library/Homebrew/keg_fix_install_names.rb
+++ b/Library/Homebrew/keg_fix_install_names.rb
@@ -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)
+ 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
+ end if changed
end
end