From 6a406763f306d88c52729343b4a65e9050f8981f Mon Sep 17 00:00:00 2001 From: buo Date: Tue, 25 Oct 2016 16:46:59 +0900 Subject: [PATCH] Open incomplete download in append mode Open the incomplete download in append mode instead of write mode. Opening in write mode truncates the existing file, so curl keeps restarting downloads instead of resuming the incomplete downloads. --- Library/Homebrew/cask/lib/hbc/download_strategy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/lib/hbc/download_strategy.rb b/Library/Homebrew/cask/lib/hbc/download_strategy.rb index 4a601af2b0..137af319a4 100644 --- a/Library/Homebrew/cask/lib/hbc/download_strategy.rb +++ b/Library/Homebrew/cask/lib/hbc/download_strategy.rb @@ -105,7 +105,7 @@ module Hbc else had_incomplete_download = temporary_path.exist? begin - File.open(temporary_path, "w+") do |f| + File.open(temporary_path, "a+") do |f| f.flock(File::LOCK_EX) _fetch f.flock(File::LOCK_UN)