From 0147b2cf99bf5e3ab2f33abe0b9a90ba8e937aa7 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Thu, 30 Jan 2020 18:03:25 +0100 Subject: [PATCH] Don't cleanup the whole cache download dir, just the downloaded artifact Otherwise whatever we download cannot be consumed (e.g. tree). Instead whoever is calling the client should care to cleanup the returned artifact --- pkg/installer/client/http.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/installer/client/http.go b/pkg/installer/client/http.go index 6971792e..8c7336ea 100644 --- a/pkg/installer/client/http.go +++ b/pkg/installer/client/http.go @@ -49,7 +49,6 @@ func (c *HttpClient) DownloadArtifact(artifact compiler.Artifact) (compiler.Arti if err != nil { return nil, err } - defer os.RemoveAll(temp) file, err = ioutil.TempFile(temp, "HttpClient") if err != nil { @@ -75,6 +74,8 @@ func (c *HttpClient) DownloadArtifact(artifact compiler.Artifact) (compiler.Arti if err != nil { continue } + defer os.RemoveAll(filepath.Join(temp, artifactName)) + ok = true break }