From f9fcdec795f80a80a4ce0edbf3112bb555c4260b Mon Sep 17 00:00:00 2001 From: "L. E. Segovia" <13498015+amyspark@users.noreply.github.com> Date: Sat, 13 Apr 2019 17:18:14 +0000 Subject: [PATCH] pathname.rb: style fixes --- Library/Homebrew/extend/pathname.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb index afb076f191..dfa1f2baa0 100644 --- a/Library/Homebrew/extend/pathname.rb +++ b/Library/Homebrew/extend/pathname.rb @@ -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