1
0
Fork 0

Try twice to remove a directory on windows because sometimes it fails due to temporary locks

pull/1552/merge
Jordi Boggiano 2013-02-11 22:51:24 +01:00
parent 908d2d91da
commit 2d40e14985
2 changed files with 8 additions and 2 deletions

View File

@ -171,7 +171,10 @@ class FileDownloader implements DownloaderInterface
{
$this->io->write(" - Removing <info>" . $package->getName() . "</info> (<comment>" . VersionParser::formatVersion($package) . "</comment>)");
if (!$this->filesystem->removeDirectory($path)) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
// retry after a bit on windows since it tends to be touchy with mass removals
if (!defined('PHP_WINDOWS_VERSION_BUILD') || (usleep(250) && !$this->filesystem->removeDirectory($path))) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
}
}

View File

@ -128,7 +128,10 @@ abstract class VcsDownloader implements DownloaderInterface
$this->io->write(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
$this->cleanChanges($path, false);
if (!$this->filesystem->removeDirectory($path)) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
// retry after a bit on windows since it tends to be touchy with mass removals
if (!defined('PHP_WINDOWS_VERSION_BUILD') || (usleep(250) && !$this->filesystem->removeDirectory($path))) {
throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
}
}
}