aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/pathname.rb
diff options
context:
space:
mode:
authorMike McQuaid2017-11-10 17:49:27 +0000
committerGitHub2017-11-10 17:49:27 +0000
commitee4172159bc09f23dbcccc2fca471b12d8bc7ecd (patch)
tree9629fbe12ddc056e925a737077035f15d8836ccf /Library/Homebrew/extend/pathname.rb
parent5318907d936d90b8d39473be288e5387e1032874 (diff)
parentde0b93f912f014155423ed9a679dcd99c40f2622 (diff)
downloadbrew-ee4172159bc09f23dbcccc2fca471b12d8bc7ecd.tar.bz2
Merge pull request #3377 from maxim-belkin/extend-pathname
pathname: new methods and improvements
Diffstat (limited to 'Library/Homebrew/extend/pathname.rb')
-rw-r--r--Library/Homebrew/extend/pathname.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index b4c7ca959..82cf10be0 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -189,6 +189,9 @@ class Pathname
rescue Errno::EPERM # rubocop:disable Lint/HandleExceptions
end
+ # Close the file before renaming to prevent the error: Device or resource busy
+ # Affects primarily NFS.
+ tf.close
File.rename(tf.path, self)
ensure
tf.close!
@@ -376,7 +379,7 @@ class Pathname
saved_perms = nil
unless writable_real?
saved_perms = stat.mode
- chmod 0644
+ FileUtils.chmod "u+rw", to_path
end
yield
ensure
@@ -469,6 +472,8 @@ class Pathname
end
end
+require "extend/os/pathname"
+
# @private
module ObserverPathnameExtension
class << self