diff options
| author | Jack Nagel | 2014-03-26 16:07:49 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-03-26 16:07:49 -0500 |
| commit | 91d31ae1f43cade6fac808b6042133c328638274 (patch) | |
| tree | dc5729269ef0b714d1c23ac747df91736fdee3cc /Library | |
| parent | 976bf3f60b9887cab6dd2b3e1ef5a8236299ad16 (diff) | |
| download | brew-91d31ae1f43cade6fac808b6042133c328638274.tar.bz2 | |
Replace files atomically when relocating
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/keg_fix_install_names.rb | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/Library/Homebrew/keg_fix_install_names.rb b/Library/Homebrew/keg_fix_install_names.rb index d36eb2543..2c444322b 100644 --- a/Library/Homebrew/keg_fix_install_names.rb +++ b/Library/Homebrew/keg_fix_install_names.rb @@ -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 |
