internal: Clean up package install temp file

The installFromHTTPURL function downloads a package to a temporary file,
then delegates to installFromLocalArchive to install it. We were
previously not deleting the temporary file afterwards. This commit fixes
that.
This commit is contained in:
Alisdair McDiarmid 2020-08-25 08:35:32 -04:00
parent b1eec0fbcd
commit 915f53af23
1 changed files with 1 additions and 0 deletions

View File

@ -53,6 +53,7 @@ func installFromHTTPURL(ctx context.Context, meta getproviders.PackageMeta, targ
return nil, fmt.Errorf("failed to open temporary file to download from %s", url)
}
defer f.Close()
defer os.Remove(f.Name())
// We'll borrow go-getter's "cancelable copy" implementation here so that
// the download can potentially be interrupted partway through.