api: avoid unnecessary file write operation

This commit is contained in:
Bo Anderson 2023-02-16 15:41:26 +00:00
parent d7d775a4ef
commit ab6bef261c
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -82,7 +82,7 @@ module Homebrew
opoo "#{target.basename}: update failed, falling back to cached version." opoo "#{target.basename}: update failed, falling back to cached version."
end end
FileUtils.touch target FileUtils.touch(target) unless skip_download
JSON.parse(target.read) JSON.parse(target.read)
rescue JSON::ParserError rescue JSON::ParserError
target.unlink target.unlink