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
This commit is contained in:
Ettore Di Giacinto
2020-01-30 18:03:25 +01:00
parent eee0136156
commit 0147b2cf99

View File

@@ -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
}