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
commitf7f200591c1ce91f4f4ddee1a76b7e1e5d16a453 (patch)
treeb106bce9072f8b12f95930506b881200b906da4a /Library
parentd8bdcf84aff98f9196ec067584b4b8f1ee917805 (diff)
downloadbrew-f7f200591c1ce91f4f4ddee1a76b7e1e5d16a453.tar.bz2
Fall back to open/write when atomic_write fails
Fixes Homebrew/homebrew#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