From 2869b5917d7004f578542fcf60d0e057f06a6c8f Mon Sep 17 00:00:00 2001 From: Alessio Caiazza <acaiazza@gitlab.com> Date: Wed, 26 Sep 2018 15:30:15 +0200 Subject: [PATCH] Fix removing file that may still be open defer invocation are performed in LIFO order, we must close a file before deleting it. This is causing failures on windows when the cache file is larger than 213000 KB --- commands/helpers/cache_extractor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/helpers/cache_extractor.go b/commands/helpers/cache_extractor.go index 55ad13f25..f847d1c8f 100644 --- a/commands/helpers/cache_extractor.go +++ b/commands/helpers/cache_extractor.go @@ -42,8 +42,8 @@ func (c *CacheExtractorCommand) download() (bool, error) { if err != nil { return false, err } - defer file.Close() defer os.Remove(file.Name()) + defer file.Close() resp, err := c.getClient().Get(c.URL) if err != nil { -- GitLab