update-license-data: use of unlink to remove existing file

This commit is contained in:
lionellloh 2020-06-30 01:29:45 +08:00
parent 0ea6245094
commit 4dcbe8790f

View File

@ -31,7 +31,8 @@ module Homebrew
update_license_data_args.parse
ohai "Updating SPDX license data..."
spdx_download_result = curl(SPDX_DATA_URL, print_stdout: false)
SPDX_PATH.write(spdx_download_result.stdout, overwrite: true)
SPDX_PATH.unlink if SPDX_PATH.exist?
SPDX_PATH.write(spdx_download_result.stdout)
return unless args.fail_if_changed?
system("git diff --stat --exit-code #{SPDX_PATH}")