You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failed downloads leave partial files in the temp directory #163
When an asset download fails, the partial file stays in the temp directory. Each release DLoad falls back to leaves one more file behind.
The cleanup in Downloader::processAsset() (src/Module/Downloader/Downloader.php:480 on 1.x) passes the wrong path:
)->then(null, staticfunction (\Throwable$e) use ($file): void {
@\unlink($file->getPath());
throw$e;
}));
SplFileObject::getPath() returns the directory, not the file, so unlink() targets the temp directory and fails, and @ hides the failure. Expected: the partial <tempDir>/<asset name> file is removed.
Steps to reproduce
Point DLoad at a repository whose newest releases fail to download for the platform. For example, use a fake GitHub API where the asset URLs of the latest releases return an error.
Set an isolated temp directory and run get.
After the command fails, the temp directory contains one empty file per attempted release, e.g. roadrunner-3.4.0-linux-amd64.tar.gz, roadrunner-3.2.0-linux-amd64.tar.gz, roadrunner-3.1.0-linux-amd64.tar.gz.
Proposed solution
Unlink $file->getPathname().
Release the SplFileObject handle before unlinking. On Windows, unlink() on a file that is still open fails.
Activity