pathname.rb: style fixes

This commit is contained in:
L. E. Segovia 2019-04-13 17:18:14 +00:00
parent f706fffc6c
commit f9fcdec795
No known key found for this signature in database
GPG Key ID: D5D1DC48B52B7AD5

View File

@ -163,7 +163,7 @@ class Pathname
# NOTE: This always overwrites.
def atomic_write(content)
old_stat = (stat if exist?)
old_stat = stat if exist?
File.atomic_write(self) do |file|
file.write(content)
end
@ -177,14 +177,16 @@ class Pathname
# Set correct permissions on new file
chown(old_stat.uid, nil)
chown(nil, old_stat.gid)
rescue Errno::EPERM, Errno::EACCES # rubocop:disable Lint/HandleExceptions
rescue Errno::EPERM, Errno::EACCES
# Changing file ownership failed, moving on.
nil
end
begin
# This operation will affect filesystem ACL's
chmod(old_stat.mode)
rescue Errno::EPERM, Errno::EACCES # rubocop:disable Lint/HandleExceptions
rescue Errno::EPERM, Errno::EACCES
# Changing file permissions failed, moving on.
nil
end
end