From 4dcbe8790fa5ab63d9a45222134793bc5b3c22f2 Mon Sep 17 00:00:00 2001 From: lionellloh Date: Tue, 30 Jun 2020 01:29:45 +0800 Subject: [PATCH] update-license-data: use of unlink to remove existing file --- Library/Homebrew/dev-cmd/update-license-data.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/update-license-data.rb b/Library/Homebrew/dev-cmd/update-license-data.rb index 713694619e..76c1397054 100644 --- a/Library/Homebrew/dev-cmd/update-license-data.rb +++ b/Library/Homebrew/dev-cmd/update-license-data.rb @@ -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}")